Skip to main content

Solution

Struct Solution 

Source
pub struct Solution<S, A, C> {
    pub states: Vec<S>,
    pub actions: Vec<A>,
    pub cost: C,
}
Expand description

A path from the start state to a goal state.

Fields§

§states: Vec<S>

The states along the path, from the start to the goal. Never empty: a start state that already is a goal yields a single state.

§actions: Vec<A>

The edge labels along the path; actions[i] leads from states[i] to states[i + 1]. Always one shorter than Solution::states.

§cost: C

The sum of the edge costs along the path.

Implementations§

Source§

impl<S, A, C> Solution<S, A, C>

Source

pub fn len(&self) -> usize

The number of edges on the path.

Source

pub fn is_empty(&self) -> bool

Returns true if the start state is the goal, so the path has no edges.

Source

pub fn goal(&self) -> &S

The goal state the path ends in.

§Panics

Never panics for solutions returned by a search, whose Solution::states is never empty.

Trait Implementations§

Source§

impl<S: Clone, A: Clone, C: Clone> Clone for Solution<S, A, C>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Debug, A: Debug, C: Debug> Debug for Solution<S, A, C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: Eq, A: Eq, C: Eq> Eq for Solution<S, A, C>

Source§

impl<S: PartialEq, A: PartialEq, C: PartialEq> PartialEq for Solution<S, A, C>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<S: PartialEq, A: PartialEq, C: PartialEq> StructuralPartialEq for Solution<S, A, C>

Auto Trait Implementations§

§

impl<S, A, C> Forget for Solution<S, A, C>

§

impl<S, A, C> Freeze for Solution<S, A, C>
where Vec<S>: Freeze, Vec<A>: Freeze, C: Freeze,

§

impl<S, A, C> Move for Solution<S, A, C>

§

impl<S, A, C> RefUnwindSafe for Solution<S, A, C>

§

impl<S, A, C> Send for Solution<S, A, C>
where C: Send, Vec<S>: Send, Vec<A>: Send,

§

impl<S, A, C> Sync for Solution<S, A, C>
where C: Sync, Vec<S>: Sync, Vec<A>: Sync,

§

impl<S, A, C> Unpin for Solution<S, A, C>
where C: Unpin, Vec<S>: Unpin, Vec<A>: Unpin,

§

impl<S, A, C> UnsafeUnpin for Solution<S, A, C>

§

impl<S, A, C> UnwindSafe for Solution<S, A, C>
where Vec<S>: UnwindSafe, Vec<A>: UnwindSafe, C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.