pub struct Edge { /* private fields */ }Expand description
Represents a edge from an ent to one or more other ents
Implementations§
Source§impl Edge
impl Edge
Sourcepub fn new<N: Into<String>, V: Into<EdgeValue>>(name: N, value: V) -> Self
pub fn new<N: Into<String>, V: Into<EdgeValue>>(name: N, value: V) -> Self
Creates a new edge with the given name, value, and deletion policy of nothing
§Examples
use entity::{Edge, EdgeDeletionPolicy};
let edge = Edge::new("edge1", 999);
assert_eq!(edge.name(), "edge1");
assert_eq!(edge.to_ids(), vec![999]);
assert_eq!(edge.deletion_policy(), EdgeDeletionPolicy::Nothing);Sourcepub fn new_with_deletion_policy<N: Into<String>, V: Into<EdgeValue>>(
name: N,
value: V,
deletion_policy: EdgeDeletionPolicy,
) -> Self
pub fn new_with_deletion_policy<N: Into<String>, V: Into<EdgeValue>>( name: N, value: V, deletion_policy: EdgeDeletionPolicy, ) -> Self
Creates a new edge with the given name, value, and deletion policy
§Examples
use entity::{Edge, EdgeDeletionPolicy};
let edge = Edge::new_with_deletion_policy(
"edge1",
999,
EdgeDeletionPolicy::DeepDelete,
);
assert_eq!(edge.name(), "edge1");
assert_eq!(edge.to_ids(), vec![999]);
assert_eq!(edge.deletion_policy(), EdgeDeletionPolicy::DeepDelete);Sourcepub fn into_value(self) -> EdgeValue
pub fn into_value(self) -> EdgeValue
Converts edge into its value
Sourcepub fn to_type(&self) -> EdgeValueType
pub fn to_type(&self) -> EdgeValueType
Converts to the edge’s value type
Sourcepub fn deletion_policy(&self) -> EdgeDeletionPolicy
pub fn deletion_policy(&self) -> EdgeDeletionPolicy
Returns the policy to perform for this edge when its ent is deleted
Sourcepub fn has_no_deletion_policy(&self) -> bool
pub fn has_no_deletion_policy(&self) -> bool
Returns true if the deletion policy is nothing
Sourcepub fn has_shallow_deletion_policy(&self) -> bool
pub fn has_shallow_deletion_policy(&self) -> bool
Returns true if the deletion policy is shallow
Sourcepub fn has_deep_deletion_policy(&self) -> bool
pub fn has_deep_deletion_policy(&self) -> bool
Returns true if the deletion policy is deep
Trait Implementations§
Source§impl<'a> From<&'a Edge> for EdgeDefinition
impl<'a> From<&'a Edge> for EdgeDefinition
Source§impl From<Edge> for EdgeDefinition
impl From<Edge> for EdgeDefinition
impl Eq for Edge
impl StructuralPartialEq for Edge
Auto Trait Implementations§
impl Freeze for Edge
impl RefUnwindSafe for Edge
impl Send for Edge
impl Sync for Edge
impl Unpin for Edge
impl UnwindSafe for Edge
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