Struct butterfly_fuzz::StateObserver
source · [−]Expand description
An observer that builds a state-graph.
The states that this observer stores must implement
the following traits: Eq, Hash, Debug, Clone, Serialize, Deserialize.
Most commonly used state types are u64, u32 or [u8; N] with N <= 32.
When you create a StateObserver always specify PS manually:
type State = u64;
let observer = StateObserver::<State>::new("state observer");The executor is responsible for calling StateObserver::record()
with states inferred from the fuzz target.
Implementations
sourceimpl<PS> StateObserver<PS> where
PS: Clone + Debug + Eq + Hash + Serialize + for<'a> Deserialize<'a>,
impl<PS> StateObserver<PS> where
PS: Clone + Debug + Eq + Hash + Serialize + for<'a> Deserialize<'a>,
sourcepub fn record(&mut self, state: &PS)
pub fn record(&mut self, state: &PS)
Tell the observer that the target has entered state state.
sourcepub fn had_new_transitions(&self) -> bool
pub fn had_new_transitions(&self) -> bool
Returns whether any new edges were created in the state-graph during the last run.
Used by StateFeedback.
sourcepub fn info(&self) -> (usize, usize)
pub fn info(&self) -> (usize, usize)
Returns the number of vertices and edges in the state-graph.
Used by StateFeedback.
sourcepub fn get_statemachine(&self) -> String
pub fn get_statemachine(&self) -> String
Returns a DOT representation of the statemachine.
Trait Implementations
sourceimpl<'de, PS> Deserialize<'de> for StateObserver<PS> where
PS: Clone + Debug + Eq + Hash,
PS: Serialize + for<'a> Deserialize<'a>,
impl<'de, PS> Deserialize<'de> for StateObserver<PS> where
PS: Clone + Debug + Eq + Hash,
PS: Serialize + for<'a> Deserialize<'a>,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<PS> Named for StateObserver<PS> where
PS: Clone + Debug + Hash + Eq + Serialize + for<'a> Deserialize<'a>,
impl<PS> Named for StateObserver<PS> where
PS: Clone + Debug + Hash + Eq + Serialize + for<'a> Deserialize<'a>,
sourceimpl<PS, I, S> Observer<I, S> for StateObserver<PS> where
PS: Clone + Debug + Hash + Eq + Serialize + for<'a> Deserialize<'a>,
impl<PS, I, S> Observer<I, S> for StateObserver<PS> where
PS: Clone + Debug + Hash + Eq + Serialize + for<'a> Deserialize<'a>,
sourcefn pre_exec(&mut self, _state: &mut S, _input: &I) -> Result<(), Error>
fn pre_exec(&mut self, _state: &mut S, _input: &I) -> Result<(), Error>
Called right before execution starts.
sourcefn post_exec(
&mut self,
_state: &mut S,
_input: &I,
_exit_kind: &ExitKind
) -> Result<(), Error>
fn post_exec(
&mut self,
_state: &mut S,
_input: &I,
_exit_kind: &ExitKind
) -> Result<(), Error>
Called right after execution finishes.
sourcefn flush(&mut self) -> Result<(), Error>
fn flush(&mut self) -> Result<(), Error>
The testcase finished execution, calculate any changes. Reserved for future use. Read more
Auto Trait Implementations
impl<PS> RefUnwindSafe for StateObserver<PS> where
PS: RefUnwindSafe,
impl<PS> Send for StateObserver<PS> where
PS: Send,
impl<PS> Sync for StateObserver<PS> where
PS: Sync,
impl<PS> Unpin for StateObserver<PS> where
PS: Unpin,
impl<PS> UnwindSafe for StateObserver<PS> where
PS: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Tail, T> Prepend<T> for Tail
impl<Tail, T> Prepend<T> for Tail
type PreprendResult = Tail
type PreprendResult = Tail
The Resulting [TupleList], of an Prepend::prepend() call,
including the prepended entry. Read more
sourcefn prepend(self, value: T) -> (T, <Tail as Prepend<T>>::PreprendResult)
fn prepend(self, value: T) -> (T, <Tail as Prepend<T>>::PreprendResult)
Prepend a value to this tuple, returning a new tuple with prepended value.