pub struct TraceOp {}Expand description
Implement trace! built-in.
It is equivalent to Idris or Haskell Trace, that is, it prints a message to stderr and pass a value along.
For instance
!(trace! "Here?" 42)prints to stderr
Here?and returns
[42]Note that the first argument does not need to be a string, which
makes trace! actually quite capable on its own. For instance
!(trace! ("Hello world!" (if True A B) 1 2 3) 42)prints to stderr
(Hello world! A 1 2 3)and returns
[42]Trait Implementations§
Source§impl CustomExecute for TraceOp
impl CustomExecute for TraceOp
Source§fn execute(&self, args: &[Atom]) -> Result<Vec<Atom>, ExecError>
fn execute(&self, args: &[Atom]) -> Result<Vec<Atom>, ExecError>
Executes grounded function on passed
args and returns list of
results as Vec<Atom> or [ExecError]. This is a restricted version of
the [CustomExecute::execute_bindings] method which is implemented if
returning of variable bindings is not required.§fn execute_bindings(
&self,
args: &[Atom],
) -> Result<Box<dyn Iterator<Item = (Atom, Option<Bindings>)>>, ExecError>
fn execute_bindings( &self, args: &[Atom], ) -> Result<Box<dyn Iterator<Item = (Atom, Option<Bindings>)>>, ExecError>
Executes grounded function on passed
args and returns list of results
with associated variable bindings if there are ones. Default implementation
calls [CustomExecute::execute] and returns no bindings.Source§impl Grounded for TraceOp
impl Grounded for TraceOp
Source§fn type_(&self) -> Atom
fn type_(&self) -> Atom
Returns type of the grounded atom. Should return same type each time
it is called. [rust_type_atom] function can be used to implement
default behavior if required.
Source§fn as_execute(&self) -> Option<&dyn CustomExecute>
fn as_execute(&self) -> Option<&dyn CustomExecute>
Returns reference to the custom execution API implementation. If
None
is returned then atom is not executable.
See [CustomExecute] for details.Auto Trait Implementations§
impl Freeze for TraceOp
impl RefUnwindSafe for TraceOp
impl Send for TraceOp
impl Sync for TraceOp
impl Unpin for TraceOp
impl UnwindSafe for TraceOp
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request