pub struct Protocol(pub TypeData);Expand description
A shared behaviour that may implement itself for types, and may be implemented by types.
Tuple Fields§
§0: TypeDataImplementations§
Source§impl Protocol
impl Protocol
Sourcepub const ID_KEY: &'static str = "__protocol_id__"
pub const ID_KEY: &'static str = "__protocol_id__"
Name of the member the ID must be assigned to for a module to be recognized as a protocol.
Sourcepub fn new(id: Sym, impls: impl IntoIterator<Item = (Sym, Expr)>) -> Self
pub fn new(id: Sym, impls: impl IntoIterator<Item = (Sym, Expr)>) -> Self
Create a new protocol with a pre-determined name
Sourcepub fn to_tree<'a>(
&self,
rest: impl IntoIterator<Item = (&'a str, ConstTree)>,
) -> ConstTree
pub fn to_tree<'a>( &self, rest: impl IntoIterator<Item = (&'a str, ConstTree)>, ) -> ConstTree
Attach a pre-existing protocol to the tree. Consider Protocol::tree.
Sourcepub fn tree<'a>(
impls: impl IntoIterator<Item = (Sym, Expr)>,
rest: impl IntoIterator<Item = (&'a str, ConstTree)>,
) -> ConstTree
pub fn tree<'a>( impls: impl IntoIterator<Item = (Sym, Expr)>, rest: impl IntoIterator<Item = (&'a str, ConstTree)>, ) -> ConstTree
Create a new protocol definition
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Protocol
impl RefUnwindSafe for Protocol
impl Send for Protocol
impl Sync for Protocol
impl Unpin for Protocol
impl UnsafeUnpin for Protocol
impl UnwindSafe for Protocol
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
Mutably borrows from an owned value. Read more
impl<_INNER> CPSPayload for _INNER
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more