pub enum ParentRef {
Root,
Index(RecordId),
}Expand description
Reference to a parent record.
This enum provides a type-safe way to represent parent references, distinguishing between root records (no parent) and records with a valid parent reference.
Variants§
Root
This record is a root (no parent).
Index(RecordId)
This record has a parent at the given index.
Implementations§
Source§impl ParentRef
impl ParentRef
Sourcepub fn from_owner_index(index: i32) -> Self
pub fn from_owner_index(index: i32) -> Self
Create a ParentRef from an owner index value.
Negative values or values that would be invalid indexes are treated as Root.
Sourcepub fn to_owner_index(self) -> i32
pub fn to_owner_index(self) -> i32
Convert to an owner index value.
Root returns -1, otherwise returns the index.
Trait Implementations§
impl Copy for ParentRef
impl Eq for ParentRef
impl StructuralPartialEq for ParentRef
Auto Trait Implementations§
impl Freeze for ParentRef
impl RefUnwindSafe for ParentRef
impl Send for ParentRef
impl Sync for ParentRef
impl Unpin for ParentRef
impl UnwindSafe for ParentRef
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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