pub struct CallBinding {
pub audience: String,
pub method: String,
pub route: String,
pub path_params: Vec<String>,
pub query: Option<String>,
pub contract_sha: [u8; 32],
pub idempotency_key: Option<String>,
pub if_match: Option<String>,
pub payload_type: Option<String>,
pub payload_accept: Option<Vec<String>>,
}Expand description
Everything one call binds, owned.
query is the raw query string as the client will send it; it is
canonicalised here, and an empty result binds as None, as it does in
the Rust client. idempotency_key and if_match are bound exactly as
the request header will carry them, so the caller must send those
headers byte for byte.
Fields§
§audience: StringThe configured name of the service addressed (never the Host).
method: StringHTTP method, e.g. "POST".
route: StringThe RPC op_id, or the REST route template.
path_params: Vec<String>REST path parameter values in template order; empty for RPC.
query: Option<String>The request’s query string, in any spelling.
contract_sha: [u8; 32]The op contract digest (OP_CONTRACTS of the generated client).
idempotency_key: Option<String>The request’s Idempotency-Key header value, if it carries one.
if_match: Option<String>The request’s If-Match header value, if it carries one.
payload_type: Option<String>The type the request payload is sealed under; None is
application/cbor. Bound in the AAD. For compact wire keys (compact
wire keys design §5.1) it is application/vnd.cratestack.compact+cbor.
When it is not CBOR the request must also carry
Cratestack-Payload-Type (selector_headers).
payload_accept: Option<Vec<String>>The types the call reads its answer in, in order of preference;
None is just application/cbor. A response sealed under another
type is refused (response_for). When it is
not just CBOR the request must also carry Cratestack-Payload-Accept.
Implementations§
Source§impl CallBinding
impl CallBinding
Source§impl CallBinding
impl CallBinding
Sourcepub fn request_payload_type(&self) -> &str
pub fn request_payload_type(&self) -> &str
The type the request payload is sealed under: the CBOR codec’s
unless payload_type says otherwise.
Sourcepub fn accepted_payload_types(&self) -> Vec<&str>
pub fn accepted_payload_types(&self) -> Vec<&str>
The types the call reads its answer in, in order of preference.
Sourcepub fn validate(&self) -> Result<(), CratestackError>
pub fn validate(&self) -> Result<(), CratestackError>
Check the payload type and the accept list: each must be sealable
(cratestack_core::is_sealable_payload_type, so never an envelope,
a +cbor-seq stream or a multipart body) and the list well formed.
Fails with Validation, before anything is sealed.
Sourcepub fn selector_headers(&self) -> Vec<(&'static str, String)>
pub fn selector_headers(&self) -> Vec<(&'static str, String)>
The payload-type selector headers this call must send, as
(name, value): Cratestack-Payload-Type when the request type is
not CBOR, Cratestack-Payload-Accept when the accept list is not
just CBOR. Empty for a default call, which sends neither. They are
not themselves signed; the binding makes a wrong one fail
verification.
Sourcepub fn response_for(
&self,
sealed_request: &[u8],
status: u16,
response_type: Option<&str>,
) -> Result<Binding<'_>, CratestackError>
pub fn response_for( &self, sealed_request: &[u8], status: u16, response_type: Option<&str>, ) -> Result<Binding<'_>, CratestackError>
The binding of the response to sealed_request with the HTTP
status, sealed under the type the response’s
Cratestack-Payload-Type header named (response_type; None
means CBOR). The type is the binding’s payload_media_type.
A type the call did not ask for (not in the accept list) is
Unauthorized, the coarse refusal, before any body is opened. The
header is not authenticated by itself: it names the string the
binding is rebuilt with, and a wrong one fails verification.
Trait Implementations§
Source§impl Clone for CallBinding
impl Clone for CallBinding
Source§fn clone(&self) -> CallBinding
fn clone(&self) -> CallBinding
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CallBinding
impl Debug for CallBinding
impl Eq for CallBinding
Source§impl PartialEq for CallBinding
impl PartialEq for CallBinding
Source§fn eq(&self, other: &CallBinding) -> bool
fn eq(&self, other: &CallBinding) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CallBinding
Auto Trait Implementations§
impl Freeze for CallBinding
impl RefUnwindSafe for CallBinding
impl Send for CallBinding
impl Sync for CallBinding
impl Unpin for CallBinding
impl UnsafeUnpin for CallBinding
impl UnwindSafe for CallBinding
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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
§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<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§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<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<T> MaybeSend for T
impl<T> MaybeSendSync for T
impl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].