Skip to main content

ResponseEncoder

Struct ResponseEncoder 

Source
pub struct ResponseEncoder<'a> { /* private fields */ }
Expand description

An independent response cursor with bounded inline framing state. The host owns the repository, request and control buffers. Keep the same stable repository for every read; it may be recreated from immutable inputs. Discovery/ref/ACK bytes must fit control; object bodies never use it. A completed prepare validates routes, commands, wants and selection budgets before output. Provider failures after headers require aborting the transport.

Implementations§

Source§

impl<'a> ResponseEncoder<'a>

Source

pub fn new( repository: &impl Repository, request: Request<'_>, control: &'a mut [u8], ) -> Result<Self>

Prepare a HEAD-only repository. Independent roots need with_selection.

Source

pub fn with_selection<R: Repository + ?Sized>( repository: &ValidatedRepository<'_, '_, R>, request: Request<'_>, storage: &'a mut SelectionStorage<'_>, control: &'a mut [u8], ) -> Result<Self>

Prepare the exact requested closure with the same limits as serve_with_selection. Selection slots stay borrowed until this cursor is dropped; separate storage permits independent overlapping responses.

Source

pub fn with_selection_storage<R: Repository + ?Sized>( repository: &ValidatedRepository<'_, '_, R>, request: Request<'_>, storage: SelectionStorage<'a>, control: &'a mut [u8], ) -> Result<Self>

Move a request’s storage descriptor into preparation. Only its selected index array and control bytes remain borrowed by the resulting cursor.

Source

pub fn with_selection_policy<R: Repository + ?Sized>( repository: &ValidatedRepository<'_, '_, R>, request: Request<'_>, storage: &'a mut SelectionStorage<'_>, options: WantOptions, control: &'a mut [u8], ) -> Result<Self>

Additive host-granted selection. Only selected indices/control are pinned; the policy cannot be inherited by another cursor or strict constructor.

Source

pub fn with_selection_storage_policy<R: Repository + ?Sized>( repository: &ValidatedRepository<'_, '_, R>, request: Request<'_>, storage: SelectionStorage<'a>, options: WantOptions, control: &'a mut [u8], ) -> Result<Self>

Source

pub fn with_revisions<R: Repository + ?Sized>( repository: &ValidatedRepository<'_, '_, R>, request: Request<'_>, storage: &'a mut RevisionStorage<'_>, control: &'a mut [u8], ) -> Result<Self>

Opt in to time/exclusion deepening. Boundary state is temporary; only selected indices and prepared control bytes survive in the response.

Source

pub fn with_revision_storage<R: Repository + ?Sized>( repository: &ValidatedRepository<'_, '_, R>, request: Request<'_>, storage: RevisionStorage<'a>, control: &'a mut [u8], ) -> Result<Self>

Source

pub fn with_revision_storage_policy<R: Repository + ?Sized>( repository: &ValidatedRepository<'_, '_, R>, request: Request<'_>, storage: RevisionStorage<'a>, options: WantOptions, control: &'a mut [u8], ) -> Result<Self>

Combine explicit revision budgets with a request-local want grant. Neither capability can be inherited by another response or a strict constructor.

Source

pub fn response(&self) -> Response

Source

pub fn cancel(&mut self)

Terminal cancellation never emits a successful terminator. Close/reset the transport; no subsequent read can access repository objects.

Source

pub fn read( &mut self, repository: &impl Repository, output: &mut [u8], ) -> Result<usize>

Pull into host staging only when ready. Retain unsent bytes across short writes. Empty output is rejected while active. Zero denotes clean EOF.

Auto Trait Implementations§

§

impl<'a> Freeze for ResponseEncoder<'a>

§

impl<'a> RefUnwindSafe for ResponseEncoder<'a>

§

impl<'a> Send for ResponseEncoder<'a>

§

impl<'a> Sync for ResponseEncoder<'a>

§

impl<'a> Unpin for ResponseEncoder<'a>

§

impl<'a> UnsafeUnpin for ResponseEncoder<'a>

§

impl<'a> UnwindSafe for ResponseEncoder<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.