pub struct UnitDesc {
pub names: &'static [&'static str],
pub wire: &'static [&'static str],
pub default: Option<usize>,
pub index: fn(&dyn Any) -> Option<usize>,
pub make: fn(usize, &mut dyn Any) -> Result<(), ModelError>,
pub set: fn(usize, &mut dyn Any) -> Result<(), ModelError>,
pub staged: (fn() -> Box<dyn Any>, for<'a> fn(&'a dyn Any) -> Option<&'a dyn Any>),
}Expand description
A #[derive(Model)] enum of unit variants, each stored as its name.
Fields§
§names: &'static [&'static str]The variants’ stored names, in declaration order.
wire: &'static [&'static str]The names the variants have in a value’s JSON form (serde’s), in declaration order: a caller reads and writes these, while the document keeps the stored one.
default: Option<usize>The #[default] variant’s position.
index: fn(&dyn Any) -> Option<usize>The position of a value’s variant.
make: fn(usize, &mut dyn Any) -> Result<(), ModelError>Put the variant at a position into out, an Option of the enum.
set: fn(usize, &mut dyn Any) -> Result<(), ModelError>Set a value to the variant at a position.
staged: (fn() -> Box<dyn Any>, for<'a> fn(&'a dyn Any) -> Option<&'a dyn Any>)An empty Option of the enum and the enum in a filled one.
Auto Trait Implementations§
impl Forget for UnitDesc
impl Freeze for UnitDesc
impl Move for UnitDesc
impl RefUnwindSafe for UnitDesc
impl Send for UnitDesc
impl Sync for UnitDesc
impl Unpin for UnitDesc
impl UnsafeUnpin for UnitDesc
impl UnwindSafe for UnitDesc
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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