pub struct ResourceSchema {
pub name: &'static str,
pub task_safe: bool,
pub operations: &'static [OperationSchema],
}Expand description
One kind of host resource: a value the host owns and Cove only names.
ADR 0013 states the contract this carries. A handle is an identity, not
state: the host keeps whatever a database.Connection really is, and Cove
holds the name of it. So a resource declares three things and nothing
else — what it is called, which operations it answers, and whether the
name may cross a task boundary.
task_safe is the Language Card’s sentence applied to a host’s own types:
“Host resources declare task-safety in their Host API schema.” A resource
whose state the host keeps behind a lock says true, and its name then
crosses like any other immutable value; one whose state belongs to the
task that opened it says false, and the name is refused at the boundary
with the same diagnostic a vector gets.
Fields§
§name: &'static strThe name Cove source writes after the module, such as Connection.
task_safe: boolWhether a handle to this resource may cross a task boundary.
operations: &'static [OperationSchema]The operations a handle answers, called as methods on it.
Implementations§
Source§impl ResourceSchema
impl ResourceSchema
Sourcepub fn operation(&self, name: &str) -> Option<&'static OperationSchema>
pub fn operation(&self, name: &str) -> Option<&'static OperationSchema>
The operation name, if this resource has one.
Trait Implementations§
Source§impl Clone for ResourceSchema
impl Clone for ResourceSchema
Source§fn clone(&self) -> ResourceSchema
fn clone(&self) -> ResourceSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ResourceSchema
Source§impl Debug for ResourceSchema
impl Debug for ResourceSchema
impl Eq for ResourceSchema
Source§impl PartialEq for ResourceSchema
impl PartialEq for ResourceSchema
Source§fn eq(&self, other: &ResourceSchema) -> bool
fn eq(&self, other: &ResourceSchema) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ResourceSchema
Auto Trait Implementations§
impl Freeze for ResourceSchema
impl RefUnwindSafe for ResourceSchema
impl Send for ResourceSchema
impl Sync for ResourceSchema
impl Unpin for ResourceSchema
impl UnsafeUnpin for ResourceSchema
impl UnwindSafe for ResourceSchema
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.