pub struct Predicate {
pub nodes: Vec<Node>,
pub edges: Vec<u16>,
}
Expand description
A program dependency graph.
Fields§
§nodes: Vec<Node>
Programs in the graph.
edges: Vec<u16>
Dependencies between programs in the graph.
Edges are directed.
The edge from A
to B
indicates that B
depends on A
, i.e., B
is a child of A
.
Implementations§
Source§impl Predicate
impl Predicate
Sourcepub fn encode(&self) -> Result<impl Iterator<Item = u8>, PredicateEncodeError>
pub fn encode(&self) -> Result<impl Iterator<Item = u8>, PredicateEncodeError>
Encode the predicate into a bytes iterator.
Sourcepub fn encoded_size(&self) -> usize
pub fn encoded_size(&self) -> usize
The size of the encoded predicate in bytes.
Sourcepub fn decode(bytes: &[u8]) -> Result<Predicate, PredicateDecodeError>
pub fn decode(bytes: &[u8]) -> Result<Predicate, PredicateDecodeError>
Decode a predicate from bytes.
Sourcepub fn node_edges(&self, node_ix: usize) -> Option<&[u16]>
pub fn node_edges(&self, node_ix: usize) -> Option<&[u16]>
The slice of edges associated with the node at the given index.
Returns None
in the case that the given node index is out of bound, or if any of the
node’s edges are out of bounds of the predicate’s edges
slice.
If the node is a leaf, returns an empty slice.
Trait Implementations§
Source§impl Address for Predicate
impl Address for Predicate
Source§fn content_address(&self) -> ContentAddress
fn content_address(&self) -> ContentAddress
Produce the content address for self.
Source§impl<'de> Deserialize<'de> for Predicate
impl<'de> Deserialize<'de> for Predicate
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Predicate, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Predicate, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Predicate
impl Ord for Predicate
Source§impl PartialOrd for Predicate
impl PartialOrd for Predicate
Source§impl Serialize for Predicate
impl Serialize for Predicate
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for Predicate
impl StructuralPartialEq for Predicate
Auto Trait Implementations§
impl Freeze for Predicate
impl RefUnwindSafe for Predicate
impl Send for Predicate
impl Sync for Predicate
impl Unpin for Predicate
impl UnwindSafe for Predicate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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