Struct entity::Edge[][src]

pub struct Edge { /* fields omitted */ }

Represents a edge from an ent to one or more other ents

Implementations

impl Edge[src]

pub fn new<N: Into<String>, V: Into<EdgeValue>>(name: N, value: V) -> Self[src]

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);

pub fn new_with_deletion_policy<N: Into<String>, V: Into<EdgeValue>>(
    name: N,
    value: V,
    deletion_policy: EdgeDeletionPolicy
) -> Self
[src]

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);

pub fn name(&self) -> &str[src]

The name of the edge

pub fn value(&self) -> &EdgeValue[src]

The value of the edge

pub fn value_mut(&mut self) -> &mut EdgeValue[src]

The mutable value of the edge

pub fn into_value(self) -> EdgeValue[src]

Converts edge into its value

pub fn to_ids(&self) -> Vec<Id>[src]

Converts to the ids of the ents referenced by this edge

pub fn to_type(&self) -> EdgeValueType[src]

Converts to the edge’s value type

pub fn deletion_policy(&self) -> EdgeDeletionPolicy[src]

Returns the policy to perform for this edge when its ent is deleted

pub fn has_no_deletion_policy(&self) -> bool[src]

Returns true if the deletion policy is nothing

pub fn has_shallow_deletion_policy(&self) -> bool[src]

Returns true if the deletion policy is shallow

pub fn has_deep_deletion_policy(&self) -> bool[src]

Returns true if the deletion policy is deep

Trait Implementations

impl Clone for Edge[src]

impl Debug for Edge[src]

impl Eq for Edge[src]

impl<'a> From<&'a Edge> for EdgeDefinition[src]

impl From<Edge> for EdgeDefinition[src]

impl PartialEq<Edge> for Edge[src]

impl StructuralEq for Edge[src]

impl StructuralPartialEq for Edge[src]

Auto Trait Implementations

impl RefUnwindSafe for Edge

impl Send for Edge

impl Sync for Edge

impl Unpin for Edge

impl UnwindSafe for Edge

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.