pub enum Slot<'a> {
Key(&'a ObjId, &'a str),
Index(&'a ObjId, usize),
Insert(&'a ObjId, usize),
}Expand description
Where a value is written: a key of a map, an existing list element, or a new list element inserted at an index.
Variants§
Implementations§
Source§impl Slot<'_>
impl Slot<'_>
Sourcepub fn current(
self,
doc: &Doc,
) -> Result<Option<(Value<'static>, ObjId)>, ModelError>
pub fn current( self, doc: &Doc, ) -> Result<Option<(Value<'static>, ObjId)>, ModelError>
What currently occupies this place. A new list element holds nothing.
Sourcepub fn put_scalar(
self,
doc: &mut Doc,
value: ScalarValue,
) -> Result<(), ModelError>
pub fn put_scalar( self, doc: &mut Doc, value: ScalarValue, ) -> Result<(), ModelError>
Write value unless the slot already holds an equal scalar.
Sourcepub fn make(self, doc: &mut Doc, value: &Value) -> Result<ObjId, ModelError>
pub fn make(self, doc: &mut Doc, value: &Value) -> Result<ObjId, ModelError>
Make value, an object and everything in it, here at once, replacing
what was here: its id.
Sourcepub fn object(self, doc: &mut Doc, kind: ObjType) -> Result<ObjId, ModelError>
pub fn object(self, doc: &mut Doc, kind: ObjType) -> Result<ObjId, ModelError>
The object of type kind in this slot, creating it (and replacing any
value of another shape) when absent.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Forget for Slot<'a>
impl<'a> Freeze for Slot<'a>
impl<'a> Move for Slot<'a>
impl<'a> RefUnwindSafe for Slot<'a>
impl<'a> Send for Slot<'a>
impl<'a> Sync for Slot<'a>
impl<'a> Unpin for Slot<'a>
impl<'a> UnsafeUnpin for Slot<'a>
impl<'a> UnwindSafe for Slot<'a>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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