pub struct Envelope<T> { /* private fields */ }Expand description
Standard Saola JSON response envelope: { data, view?, auth? } with X-Saola-Envelope: 1.
Implementations§
Source§impl<T: Serialize> Envelope<T>
impl<T: Serialize> Envelope<T>
pub fn new(data: T) -> Self
pub fn ok(data: T) -> Self
pub fn created(data: T) -> Self
pub fn view(self, view_key: impl Into<String>) -> Self
pub fn auth(self, auth: ClientAuthProjection) -> Self
pub fn status(self, status: StatusCode) -> Self
pub fn view_revision(self, revision: impl Into<String>) -> Self
pub fn language_revision(self, revision: impl Into<String>) -> Self
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
Trait Implementations§
Source§impl<T: Serialize> IntoResponse for Envelope<T>
impl<T: Serialize> IntoResponse for Envelope<T>
Source§fn with_status(self, status: impl IntoStatusCode) -> Response
fn with_status(self, status: impl IntoStatusCode) -> Response
Send a cookie with this response, replacing any cookie the response already sends with the
same name, path, and domain. Read more
Source§fn with_header<K, V>(self, name: K, value: V) -> Response
fn with_header<K, V>(self, name: K, value: V) -> Response
Send a header with the response, replacing any header with the same name. A name or value
that isn’t a valid header makes the response a
500 error.Source§fn with_headers<K, V>(
self,
headers: impl IntoIterator<Item = (K, V)>,
) -> Response
fn with_headers<K, V>( self, headers: impl IntoIterator<Item = (K, V)>, ) -> Response
Send several headers with the response, each replacing any header with the same name. A
name or value that isn’t a valid header makes the response a
500 error.Auto Trait Implementations§
impl<T> Forget for Envelope<T>
impl<T> Freeze for Envelope<T>where
T: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const LeafNode<String, ClientGuardState> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, ClientGuardState)>>: Freeze,
NonZero<u16>: Freeze,
PhantomData<(String, String)>: Freeze,
impl<T> Move for Envelope<T>
impl<T> RefUnwindSafe for Envelope<T>
impl<T> Send for Envelope<T>
impl<T> Sync for Envelope<T>
impl<T> Unpin for Envelope<T>
impl<T> UnsafeUnpin for Envelope<T>where
T: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const LeafNode<String, ClientGuardState> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, ClientGuardState)>>: UnsafeUnpin,
NonZeroU16Inner: UnsafeUnpin,
PhantomData<(String, String)>: UnsafeUnpin,
impl<T> UnwindSafe for Envelope<T>where
T: UnwindSafe,
RawVecInner: UnwindSafe,
BTreeMap<String, ClientGuardState>: UnwindSafe,
NonZero<u16>: UnwindSafe,
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