pub struct ClosureTreeRepository<M>where
M: ClosureTreeModel,{ /* private fields */ }Expand description
Repository exposing the higher-level closure-tree operations for a given model.
Implementations§
Source§impl<M> ClosureTreeRepository<M>where
M: ClosureTreeModel,
impl<M> ClosureTreeRepository<M>where
M: ClosureTreeModel,
pub fn new() -> Self
pub async fn parent( &self, conn: &DatabaseConnection, model: &M, ) -> Result<Option<M>, ClosureTreeError>
pub async fn children( &self, conn: &DatabaseConnection, model: &M, ) -> Result<Vec<M>, ClosureTreeError>
pub async fn roots( &self, conn: &DatabaseConnection, ) -> Result<Vec<M>, ClosureTreeError>
pub async fn descendants( &self, conn: &DatabaseConnection, model: &M, ) -> Result<Vec<M>, ClosureTreeError>
pub async fn self_and_descendants( &self, conn: &DatabaseConnection, model: &M, ) -> Result<Vec<M>, ClosureTreeError>
pub async fn find_by_path<S: AsRef<str>>( &self, conn: &DatabaseConnection, segments: &[S], ) -> Result<Option<M>, ClosureTreeError>
pub async fn find_or_create_by_path<S: AsRef<str>>( &self, conn: &DatabaseConnection, segments: &[S], ) -> Result<M, ClosureTreeError>
Trait Implementations§
Source§impl<M> Debug for ClosureTreeRepository<M>where
M: ClosureTreeModel + Debug,
impl<M> Debug for ClosureTreeRepository<M>where
M: ClosureTreeModel + Debug,
Source§impl<M> Default for ClosureTreeRepository<M>where
M: ClosureTreeModel + Default,
impl<M> Default for ClosureTreeRepository<M>where
M: ClosureTreeModel + Default,
Source§fn default() -> ClosureTreeRepository<M>
fn default() -> ClosureTreeRepository<M>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<M> Freeze for ClosureTreeRepository<M>
impl<M> RefUnwindSafe for ClosureTreeRepository<M>where
M: RefUnwindSafe,
impl<M> Send for ClosureTreeRepository<M>
impl<M> Sync for ClosureTreeRepository<M>
impl<M> Unpin for ClosureTreeRepository<M>where
M: Unpin,
impl<M> UnsafeUnpin for ClosureTreeRepository<M>
impl<M> UnwindSafe for ClosureTreeRepository<M>where
M: UnwindSafe,
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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