pub struct SequenceGraph {
pub nodes: HashMap<u64, SequenceNode>,
pub edges: Vec<SequenceEdge>,
pub start_node: u64,
pub current: u64,
pub flags: HashSet<String>,
/* private fields */
}Fields§
§nodes: HashMap<u64, SequenceNode>§edges: Vec<SequenceEdge>§start_node: u64§current: u64§flags: HashSet<String>Implementations§
Source§impl SequenceGraph
impl SequenceGraph
pub fn new() -> Self
pub fn add_node(&mut self, name: &str, sequence: &str, duration: f64) -> u64
pub fn add_edge( &mut self, from_id: u64, to_id: u64, condition: &str, weight: f32, )
pub fn set_flag(&mut self, flag: &str)
pub fn clear_flag(&mut self, flag: &str)
Sourcepub fn condition_met(&self, condition: &str) -> bool
pub fn condition_met(&self, condition: &str) -> bool
Evaluate condition string against current flag set.
Sourcepub fn next_nodes(&self) -> Vec<u64>
pub fn next_nodes(&self) -> Vec<u64>
Get all reachable next nodes from current.
Sourcepub fn advance(&mut self) -> Option<&SequenceNode>
pub fn advance(&mut self) -> Option<&SequenceNode>
Advance to best-matching next node.
pub fn current_node(&self) -> Option<&SequenceNode>
Auto Trait Implementations§
impl Freeze for SequenceGraph
impl RefUnwindSafe for SequenceGraph
impl Send for SequenceGraph
impl Sync for SequenceGraph
impl Unpin for SequenceGraph
impl UnsafeUnpin for SequenceGraph
impl UnwindSafe for SequenceGraph
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.