Trait TreeLike

Source
pub trait TreeLike: Sized {
    type F: FileLike + Debug;

    // Required methods
    fn ids(&self) -> HashSet<&Uuid>;
    fn maybe_find(&self, id: &Uuid) -> Option<&Self::F>;

    // Provided methods
    fn find(&self, id: &Uuid) -> SharedResult<&Self::F> { ... }
    fn maybe_find_parent<F2: FileLike>(&self, file: &F2) -> Option<&Self::F> { ... }
    fn find_parent<F2: FileLike>(&self, file: &F2) -> SharedResult<&Self::F> { ... }
    fn owned_ids(&self) -> HashSet<Uuid> { ... }
    fn all_files(&self) -> SharedResult<Vec<&Self::F>> { ... }
    fn stage<Staged>(&self, staged: Staged) -> StagedTree<&Self, Staged>
       where Staged: TreeLike<F = Self::F>,
             Self: Sized { ... }
    fn to_staged<Staged>(self, staged: Staged) -> StagedTree<Self, Staged>
       where Staged: TreeLike<F = Self::F>,
             Self: Sized { ... }
    fn as_lazy(&self) -> LazyTree<&Self> { ... }
    fn to_lazy(self) -> LazyTree<Self> { ... }
}

Required Associated Types§

Required Methods§

Source

fn ids(&self) -> HashSet<&Uuid>

Source

fn maybe_find(&self, id: &Uuid) -> Option<&Self::F>

Provided Methods§

Source

fn find(&self, id: &Uuid) -> SharedResult<&Self::F>

Source

fn maybe_find_parent<F2: FileLike>(&self, file: &F2) -> Option<&Self::F>

Source

fn find_parent<F2: FileLike>(&self, file: &F2) -> SharedResult<&Self::F>

Source

fn owned_ids(&self) -> HashSet<Uuid>

Source

fn all_files(&self) -> SharedResult<Vec<&Self::F>>

Source

fn stage<Staged>(&self, staged: Staged) -> StagedTree<&Self, Staged>
where Staged: TreeLike<F = Self::F>, Self: Sized,

Source

fn to_staged<Staged>(self, staged: Staged) -> StagedTree<Self, Staged>
where Staged: TreeLike<F = Self::F>, Self: Sized,

Source

fn as_lazy(&self) -> LazyTree<&Self>

Source

fn to_lazy(self) -> LazyTree<Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<F> TreeLike for Option<F>
where F: FileLike,

Source§

type F = F

Source§

fn ids(&self) -> HashSet<&Uuid>

Source§

fn maybe_find(&self, id: &Uuid) -> Option<&F>

Source§

impl<F> TreeLike for Vec<F>
where F: FileLike,

Source§

type F = F

Source§

fn ids(&self) -> HashSet<&Uuid>

Source§

fn maybe_find(&self, id: &Uuid) -> Option<&F>

Source§

impl<F> TreeLike for LookupTable<Uuid, F>
where F: FileLike + Serialize,

Source§

type F = F

Source§

fn ids(&self) -> HashSet<&Uuid>

Source§

fn maybe_find(&self, id: &Uuid) -> Option<&Self::F>

Source§

impl<T> TreeLike for &T
where T: TreeLike,

Source§

type F = <T as TreeLike>::F

Source§

fn ids(&self) -> HashSet<&Uuid>

Source§

fn maybe_find(&self, id: &Uuid) -> Option<&Self::F>

Source§

impl<T> TreeLike for &mut T
where T: TreeLike,

Source§

type F = <T as TreeLike>::F

Source§

fn ids(&self) -> HashSet<&Uuid>

Source§

fn maybe_find(&self, id: &Uuid) -> Option<&Self::F>

Implementors§

Source§

impl TreeLike for ServerTree<'_>

Source§

impl<Base, Staged> TreeLike for StagedTree<Base, Staged>
where Base: TreeLike, Staged: TreeLike<F = Base::F>,

Source§

type F = <Base as TreeLike>::F

Source§

impl<T: TreeLike> TreeLike for LazyTree<T>

Source§

type F = <T as TreeLike>::F