pub trait Doublets<T: LinkReference>: Links<T> {
Show 38 methods
// Required method
fn get_link(&self, index: T) -> Option<Link<T>>;
// Provided methods
fn count_by(&self, query: impl ToQuery<T>) -> T
where Self: Sized { ... }
fn count(&self) -> T
where Self: Sized { ... }
fn create_by_with<F>(
&mut self,
query: impl ToQuery<T>,
handler: F,
) -> Result<Flow, Error<T>>
where F: FnMut(Link<T>, Link<T>) -> Flow,
Self: Sized { ... }
fn create_by(&mut self, query: impl ToQuery<T>) -> Result<T, Error<T>>
where Self: Sized { ... }
fn create_with<F>(&mut self, handler: F) -> Result<Flow, Error<T>>
where F: FnMut(Link<T>, Link<T>) -> Flow,
Self: Sized { ... }
fn create(&mut self) -> Result<T, Error<T>>
where Self: Sized { ... }
fn each_by<F>(&self, query: impl ToQuery<T>, handler: F) -> Flow
where F: FnMut(Link<T>) -> Flow,
Self: Sized { ... }
fn each<F>(&self, handler: F) -> Flow
where F: FnMut(Link<T>) -> Flow,
Self: Sized { ... }
fn update_by_with<H>(
&mut self,
query: impl ToQuery<T>,
change: impl ToQuery<T>,
handler: H,
) -> Result<Flow, Error<T>>
where H: FnMut(Link<T>, Link<T>) -> Flow,
Self: Sized { ... }
fn update_by(
&mut self,
query: impl ToQuery<T>,
change: impl ToQuery<T>,
) -> Result<T, Error<T>>
where Self: Sized { ... }
fn update_with<F>(
&mut self,
index: T,
source: T,
target: T,
handler: F,
) -> Result<Flow, Error<T>>
where F: FnMut(Link<T>, Link<T>) -> Flow,
Self: Sized { ... }
fn update(&mut self, index: T, source: T, target: T) -> Result<T, Error<T>>
where Self: Sized { ... }
fn delete_by_with<F>(
&mut self,
query: impl ToQuery<T>,
handler: F,
) -> Result<Flow, Error<T>>
where F: FnMut(Link<T>, Link<T>) -> Flow,
Self: Sized { ... }
fn delete_by(&mut self, query: impl ToQuery<T>) -> Result<T, Error<T>>
where Self: Sized { ... }
fn delete_with<F>(&mut self, index: T, handler: F) -> Result<Flow, Error<T>>
where F: FnMut(Link<T>, Link<T>) -> Flow,
Self: Sized { ... }
fn delete(&mut self, index: T) -> Result<T, Error<T>>
where Self: Sized { ... }
fn try_get_link(&self, index: T) -> Result<Link<T>, Error<T>> { ... }
fn delete_all(&mut self) -> Result<(), Error<T>>
where Self: Sized { ... }
fn delete_query_with<F>(
&mut self,
query: impl ToQuery<T>,
handler: F,
) -> Result<(), Error<T>>
where F: FnMut(Link<T>, Link<T>) -> Flow,
Self: Sized { ... }
fn delete_usages_with<F>(
&mut self,
index: T,
handler: F,
) -> Result<(), Error<T>>
where F: FnMut(Link<T>, Link<T>) -> Flow,
Self: Sized { ... }
fn delete_usages(&mut self, index: T) -> Result<(), Error<T>>
where Self: Sized { ... }
fn create_point(&mut self) -> Result<T, Error<T>>
where Self: Sized { ... }
fn create_link_with<F>(
&mut self,
source: T,
target: T,
handler: F,
) -> Result<Flow, Error<T>>
where F: FnMut(Link<T>, Link<T>) -> Flow,
Self: Sized { ... }
fn create_link(&mut self, source: T, target: T) -> Result<T, Error<T>>
where Self: Sized { ... }
fn found(&self, query: impl ToQuery<T>) -> bool
where Self: Sized { ... }
fn find(&self, query: impl ToQuery<T>) -> Option<Link<T>>
where Self: Sized { ... }
fn search(&self, source: T, target: T) -> Option<T>
where Self: Sized { ... }
fn search_or(&self, source: T, target: T, default: T) -> T
where Self: Sized { ... }
fn single(&self, query: impl ToQuery<T>) -> Option<Link<T>>
where Self: Sized { ... }
fn get_or_create(&mut self, source: T, target: T) -> Result<T, Error<T>>
where Self: Sized { ... }
fn count_usages(&self, index: T) -> Result<T, Error<T>>
where Self: Sized { ... }
fn usages(&self, index: T) -> Result<Vec<T>, Error<T>>
where Self: Sized { ... }
fn exist(&self, link: T) -> bool
where Self: Sized { ... }
fn has_usages(&self, link: T) -> bool
where Self: Sized { ... }
fn rebase_with<F>(
&mut self,
old: T,
new: T,
handler: F,
) -> Result<(), Error<T>>
where F: FnMut(Link<T>, Link<T>) -> Flow,
Self: Sized { ... }
fn rebase(&mut self, old: T, new: T) -> Result<T, Error<T>>
where Self: Sized { ... }
fn rebase_and_delete(&mut self, old: T, new: T) -> Result<T, Error<T>>
where Self: Sized { ... }
}Expand description
Required Methods§
Provided Methods§
Sourcefn create_by_with<F>(
&mut self,
query: impl ToQuery<T>,
handler: F,
) -> Result<Flow, Error<T>>
fn create_by_with<F>( &mut self, query: impl ToQuery<T>, handler: F, ) -> Result<Flow, Error<T>>
Creates a link matching query, calling handler on each created link.
Sourcefn create_by(&mut self, query: impl ToQuery<T>) -> Result<T, Error<T>>where
Self: Sized,
fn create_by(&mut self, query: impl ToQuery<T>) -> Result<T, Error<T>>where
Self: Sized,
Creates a link matching query and returns its index.
Sourcefn create_with<F>(&mut self, handler: F) -> Result<Flow, Error<T>>
fn create_with<F>(&mut self, handler: F) -> Result<Flow, Error<T>>
Creates a new link and calls handler with the before/after states.
Sourcefn create(&mut self) -> Result<T, Error<T>>where
Self: Sized,
fn create(&mut self) -> Result<T, Error<T>>where
Self: Sized,
Creates a new uninitialized link and returns its index.
Sourcefn each_by<F>(&self, query: impl ToQuery<T>, handler: F) -> Flow
fn each_by<F>(&self, query: impl ToQuery<T>, handler: F) -> Flow
Iterates over links matching query, calling handler for each.
Sourcefn each<F>(&self, handler: F) -> Flow
fn each<F>(&self, handler: F) -> Flow
Iterates over all links in the store, calling handler for each.
Sourcefn update_by_with<H>(
&mut self,
query: impl ToQuery<T>,
change: impl ToQuery<T>,
handler: H,
) -> Result<Flow, Error<T>>
fn update_by_with<H>( &mut self, query: impl ToQuery<T>, change: impl ToQuery<T>, handler: H, ) -> Result<Flow, Error<T>>
Updates links matching query to change, calling handler with before/after.
Sourcefn update_by(
&mut self,
query: impl ToQuery<T>,
change: impl ToQuery<T>,
) -> Result<T, Error<T>>where
Self: Sized,
fn update_by(
&mut self,
query: impl ToQuery<T>,
change: impl ToQuery<T>,
) -> Result<T, Error<T>>where
Self: Sized,
Updates links matching query to change and returns the updated link’s index.
Sourcefn update_with<F>(
&mut self,
index: T,
source: T,
target: T,
handler: F,
) -> Result<Flow, Error<T>>
fn update_with<F>( &mut self, index: T, source: T, target: T, handler: F, ) -> Result<Flow, Error<T>>
Updates the link at index to (index, source, target), calling handler.
Sourcefn update(&mut self, index: T, source: T, target: T) -> Result<T, Error<T>>where
Self: Sized,
fn update(&mut self, index: T, source: T, target: T) -> Result<T, Error<T>>where
Self: Sized,
Updates the link at index to (index, source, target) and returns the index.
Sourcefn delete_by_with<F>(
&mut self,
query: impl ToQuery<T>,
handler: F,
) -> Result<Flow, Error<T>>
fn delete_by_with<F>( &mut self, query: impl ToQuery<T>, handler: F, ) -> Result<Flow, Error<T>>
Deletes links matching query, calling handler with before/after states.
Sourcefn delete_by(&mut self, query: impl ToQuery<T>) -> Result<T, Error<T>>where
Self: Sized,
fn delete_by(&mut self, query: impl ToQuery<T>) -> Result<T, Error<T>>where
Self: Sized,
Deletes links matching query and returns the deleted link’s index.
Sourcefn delete_with<F>(&mut self, index: T, handler: F) -> Result<Flow, Error<T>>
fn delete_with<F>(&mut self, index: T, handler: F) -> Result<Flow, Error<T>>
Deletes the link at index, calling handler with before/after states.
Sourcefn delete(&mut self, index: T) -> Result<T, Error<T>>where
Self: Sized,
fn delete(&mut self, index: T) -> Result<T, Error<T>>where
Self: Sized,
Deletes the link at index and returns its former index.
Sourcefn try_get_link(&self, index: T) -> Result<Link<T>, Error<T>>
fn try_get_link(&self, index: T) -> Result<Link<T>, Error<T>>
Returns the link at index, or Err(Error::NotExists) if it does not exist.
Sourcefn delete_all(&mut self) -> Result<(), Error<T>>where
Self: Sized,
fn delete_all(&mut self) -> Result<(), Error<T>>where
Self: Sized,
Deletes all links in the store.
Sourcefn delete_query_with<F>(
&mut self,
query: impl ToQuery<T>,
handler: F,
) -> Result<(), Error<T>>
fn delete_query_with<F>( &mut self, query: impl ToQuery<T>, handler: F, ) -> Result<(), Error<T>>
Deletes all links matching query, calling handler for each deletion.
Duplicate matches are deleted once, in reverse order of their first occurrence.
Sourcefn delete_usages_with<F>(
&mut self,
index: T,
handler: F,
) -> Result<(), Error<T>>
fn delete_usages_with<F>( &mut self, index: T, handler: F, ) -> Result<(), Error<T>>
Deletes each other link that uses index as a source or target once,
calling handler for each deletion.
Sourcefn delete_usages(&mut self, index: T) -> Result<(), Error<T>>where
Self: Sized,
fn delete_usages(&mut self, index: T) -> Result<(), Error<T>>where
Self: Sized,
Deletes all links that use index as a source or target.
Sourcefn create_point(&mut self) -> Result<T, Error<T>>where
Self: Sized,
fn create_point(&mut self) -> Result<T, Error<T>>where
Self: Sized,
Creates a self-referential point link and returns its index.
Sourcefn create_link_with<F>(
&mut self,
source: T,
target: T,
handler: F,
) -> Result<Flow, Error<T>>
fn create_link_with<F>( &mut self, source: T, target: T, handler: F, ) -> Result<Flow, Error<T>>
Creates a link from source to target, calling handler with before/after states.
Sourcefn create_link(&mut self, source: T, target: T) -> Result<T, Error<T>>where
Self: Sized,
fn create_link(&mut self, source: T, target: T) -> Result<T, Error<T>>where
Self: Sized,
Creates a link from source to target and returns its index.
Sourcefn found(&self, query: impl ToQuery<T>) -> boolwhere
Self: Sized,
fn found(&self, query: impl ToQuery<T>) -> boolwhere
Self: Sized,
Returns true if at least one link matches query.
Sourcefn find(&self, query: impl ToQuery<T>) -> Option<Link<T>>where
Self: Sized,
fn find(&self, query: impl ToQuery<T>) -> Option<Link<T>>where
Self: Sized,
Returns the first link matching query, or None.
Sourcefn search(&self, source: T, target: T) -> Option<T>where
Self: Sized,
fn search(&self, source: T, target: T) -> Option<T>where
Self: Sized,
Returns the index of a link with the given source and target, or None.
fn search_or(&self, source: T, target: T, default: T) -> Twhere
Self: Sized,
use search instead
Sourcefn single(&self, query: impl ToQuery<T>) -> Option<Link<T>>where
Self: Sized,
fn single(&self, query: impl ToQuery<T>) -> Option<Link<T>>where
Self: Sized,
Returns the link matching query only if exactly one link matches; None otherwise.
Sourcefn get_or_create(&mut self, source: T, target: T) -> Result<T, Error<T>>where
Self: Sized,
fn get_or_create(&mut self, source: T, target: T) -> Result<T, Error<T>>where
Self: Sized,
Returns the index of the (source, target) link, creating it if it does not exist.
Sourcefn count_usages(&self, index: T) -> Result<T, Error<T>>where
Self: Sized,
fn count_usages(&self, index: T) -> Result<T, Error<T>>where
Self: Sized,
Returns the number of distinct other links that reference index as a source or target.
Sourcefn usages(&self, index: T) -> Result<Vec<T>, Error<T>>where
Self: Sized,
fn usages(&self, index: T) -> Result<Vec<T>, Error<T>>where
Self: Sized,
Returns the indices of distinct other links that reference index as a source or target.
Sourcefn exist(&self, link: T) -> boolwhere
Self: Sized,
fn exist(&self, link: T) -> boolwhere
Self: Sized,
Returns true if the link at link exists (internal or external).
Sourcefn has_usages(&self, link: T) -> boolwhere
Self: Sized,
fn has_usages(&self, link: T) -> boolwhere
Self: Sized,
Returns true if any other link references link as a source or target.
Sourcefn rebase_with<F>(&mut self, old: T, new: T, handler: F) -> Result<(), Error<T>>
fn rebase_with<F>(&mut self, old: T, new: T, handler: F) -> Result<(), Error<T>>
Re-points all usages of old to new, calling handler for each update.
A usage that references old as both source and target is updated once,
replacing both references together. The link at old itself is excluded.
Sourcefn rebase(&mut self, old: T, new: T) -> Result<T, Error<T>>where
Self: Sized,
fn rebase(&mut self, old: T, new: T) -> Result<T, Error<T>>where
Self: Sized,
Re-points all usages of old to new and returns new.
Sourcefn rebase_and_delete(&mut self, old: T, new: T) -> Result<T, Error<T>>where
Self: Sized,
fn rebase_and_delete(&mut self, old: T, new: T) -> Result<T, Error<T>>where
Self: Sized,
Re-points all usages of old to new, then deletes old. Returns new.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".