Struct Path
pub struct Path<R, T> { /* private fields */ }Expand description
The location of a T inside the record R. See the module docs.
Implementations§
§impl<R, T> Path<R, T>where
R: Model,
impl<R, T> Path<R, T>where
R: Model,
pub fn object(&self, doc: &AutoCommit) -> Option<ExId>
pub fn object(&self, doc: &AutoCommit) -> Option<ExId>
The object the value at this path is stored in — a record’s map, a
list, a text — resolved through each container’s own layout, for an
editor that binds to the object itself (a rich-text field inside a
collection item); None when absent or stored as a scalar.
§impl<R, T> Path<R, T>
impl<R, T> Path<R, T>
pub fn from_segments(segments: Vec<Segment>) -> Path<R, T>
pub fn from_segments(segments: Vec<Segment>) -> Path<R, T>
A path from stored segments. A path read back from storage or the wire is checked when an edit at it applies.
pub fn segments(&self) -> &[Segment]
pub fn into_segments(self) -> Vec<Segment>
pub fn under<P>(&self, prefix: &Path<P, R>) -> Path<P, T>
pub fn under<P>(&self, prefix: &Path<P, R>) -> Path<P, T>
This path, rooted at an item, seen from the record containing it: a
row’s favorite as Snippets › snippets › <id> › favorite.
pub fn get<'a>(&self, root: &'a R) -> Option<&'a T>where
R: Model + 'static,
T: 'static,
pub fn get<'a>(&self, root: &'a R) -> Option<&'a T>where
R: Model + 'static,
T: 'static,
The value at this path in root, if it is there.
pub fn starts_with<U>(&self, other: &Path<R, U>) -> bool
pub fn starts_with<U>(&self, other: &Path<R, U>) -> bool
Whether self is other or lies inside it.
§impl<R, T> Path<R, Collection<T>>where
T: Model,
impl<R, T> Path<R, Collection<T>>where
T: Model,
§impl<R, T> Path<R, Grid<T>>where
T: Model,
impl<R, T> Path<R, Grid<T>>where
T: Model,
pub fn cell(&self, row: &Id, column: &Id) -> <T as Model>::Paths<R>
pub fn cell(&self, row: &Id, column: &Id) -> <T as Model>::Paths<R>
The cell at row, column, its own paths rooted here.
pub fn insert_row(&self, at: usize) -> Edit<R>
pub fn insert_row(&self, at: usize) -> Edit<R>
Insert a row at at (clamped) under a fresh id minted when the edit
applies.
pub fn insert_column(&self, at: usize) -> Edit<R>
pub fn insert_column(&self, at: usize) -> Edit<R>
Insert a column at at (clamped) under a fresh id.
pub fn remove_row(&self, row: &Id) -> Edit<R>
pub fn remove_row(&self, row: &Id) -> Edit<R>
Remove a row and its cells.
pub fn remove_column(&self, column: &Id) -> Edit<R>
pub fn remove_column(&self, column: &Id) -> Edit<R>
Remove a column and its cells.
Trait Implementations§
§impl<'de, R, T> Deserialize<'de> for Path<R, T>
impl<'de, R, T> Deserialize<'de> for Path<R, T>
§fn deserialize<D>(
deserializer: D,
) -> Result<Path<R, T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Path<R, T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl<R, T> Ord for Path<R, T>
impl<R, T> Ord for Path<R, T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
§impl<R, T> PartialOrd for Path<R, T>
impl<R, T> PartialOrd for Path<R, T>
§impl<R, T> Serialize for Path<R, T>
impl<R, T> Serialize for Path<R, T>
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl<R, T> Eq for Path<R, T>
Auto Trait Implementations§
impl<R, T> Freeze for Path<R, T>
impl<R, T> RefUnwindSafe for Path<R, T>
impl<R, T> Send for Path<R, T>
impl<R, T> Sync for Path<R, T>
impl<R, T> Unpin for Path<R, T>
impl<R, T> UnsafeUnpin for Path<R, T>
impl<R, T> UnwindSafe for Path<R, T>
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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.§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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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