Struct StepOutput
#[non_exhaustive]pub struct StepOutput {
pub text: String,
pub truncated: bool,
pub bytes: Option<u64>,
pub error: bool,
}Expand description
What a step’s call answered, bounded by the contract (steps/v1’s output).
text is at most [STEP_OUTPUT_MAX_BYTES] bytes. When the answer was longer, truncated is set
and bytes is its original size: text then keeps the start and the end of the answer (an error
is usually at the end) with a line between them that says how many bytes are not kept.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.text: StringThe answer as text, or, when error is set, the error the call ended with.
truncated: boolThe answer was cut: text is not all of it.
bytes: Option<u64>The size of the whole answer in bytes, when it was cut.
error: boolThe call failed, and text is its error.
Implementations§
§impl StepOutput
impl StepOutput
pub fn new(text: impl AsRef<str>, error: bool) -> StepOutput
pub fn new(text: impl AsRef<str>, error: bool) -> StepOutput
text as an output of at most [STEP_OUTPUT_MAX_BYTES] bytes. error: the call failed and
text is its error.
pub fn within(text: impl AsRef<str>, error: bool, max: usize) -> StepOutput
pub fn within(text: impl AsRef<str>, error: bool, max: usize) -> StepOutput
As new, with a bound of max bytes (at most [STEP_OUTPUT_MAX_BYTES]: the
contract’s limit is never exceeded).
Control characters other than the line break and the tab are dropped. A text longer than the
bound keeps its head (three quarters of what the bound leaves) and its tail, with
… n bytes not kept … on a line of its own between them, so that the whole is within max.
Trait Implementations§
§impl Clone for StepOutput
impl Clone for StepOutput
§fn clone(&self) -> StepOutput
fn clone(&self) -> StepOutput
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for StepOutput
impl Debug for StepOutput
§impl<'de> Deserialize<'de> for StepOutput
impl<'de> Deserialize<'de> for StepOutput
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<StepOutput, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StepOutput, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for StepOutput
§impl PartialEq for StepOutput
impl PartialEq for StepOutput
§impl Serialize for StepOutput
impl Serialize for StepOutput
§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,
impl StructuralPartialEq for StepOutput
Auto Trait Implementations§
impl Freeze for StepOutput
impl RefUnwindSafe for StepOutput
impl Send for StepOutput
impl Sync for StepOutput
impl Unpin for StepOutput
impl UnsafeUnpin for StepOutput
impl UnwindSafe for StepOutput
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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>
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>
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].