pub struct Path<R, T> { /* private fields */ }Expand description
The location of a T inside the record R. See the module docs.
Implementations§
Source§impl<R: Model, T> Path<R, T>
impl<R: Model, T> Path<R, T>
Sourcepub fn object(&self, doc: &Doc) -> Option<ObjId>
pub fn object(&self, doc: &Doc) -> Option<ObjId>
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.
Source§impl<R, T> Path<R, T>
impl<R, T> Path<R, T>
Sourcepub fn from_segments(segments: Vec<Segment>) -> Self
pub fn from_segments(segments: Vec<Segment>) -> Self
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>
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Source§impl<R, T: Operations> Path<R, T>
impl<R, T: Operations> Path<R, T>
Source§impl<R, T: Model> Path<R, Collection<T>>
impl<R, T: Model> Path<R, Collection<T>>
Sourcepub fn insert(&self, at: usize, value: &T) -> Edit<R>
pub fn insert(&self, at: usize, value: &T) -> Edit<R>
Insert value at at (clamped to the end) under a fresh id minted
when the edit applies.
Sourcepub fn insert_as(&self, id: &Id, at: usize, value: &T) -> Edit<R>
pub fn insert_as(&self, id: &Id, at: usize, value: &T) -> Edit<R>
Insert value at at (clamped to the end) under id.
Source§impl<R, T: Model> Path<R, Grid<T>>
impl<R, T: Model> Path<R, Grid<T>>
Sourcepub fn cell(&self, row: &Id, column: &Id) -> T::Paths<R>
pub fn cell(&self, row: &Id, column: &Id) -> T::Paths<R>
The cell at row, column, its own paths rooted here.
Sourcepub fn set_cell(&self, row: &Id, column: &Id, value: Option<&T>) -> Edit<R>
pub fn set_cell(&self, row: &Id, column: &Id, value: Option<&T>) -> Edit<R>
Set or clear one cell.
Sourcepub 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.
Sourcepub 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.
Sourcepub fn remove_row(&self, row: &Id) -> Edit<R>
pub fn remove_row(&self, row: &Id) -> Edit<R>
Remove a row and its cells.
Sourcepub 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§
Source§impl<'de, R, T> Deserialize<'de> for Path<R, T>
impl<'de, R, T> Deserialize<'de> for Path<R, T>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl<R, T> Eq for Path<R, T>
Source§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,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<R, T> PartialOrd for Path<R, T>
impl<R, T> PartialOrd for Path<R, T>
Auto Trait Implementations§
impl<R, T> Forget for Path<R, T>
impl<R, T> Freeze for Path<R, T>
impl<R, T> Move 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§
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<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> ⓘ
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