pub struct ServerRequest<'a> {
    requested_frames: usize,
    buffer_set: &'a mut dyn BufferSet,
}
Expand description

ServerRequest represents an active request from the server for the client to provide a buffer in shared memory to playback from or capture to.

Fields§

§requested_frames: usize§buffer_set: &'a mut dyn BufferSet

Implementations§

source§

impl<'a> ServerRequest<'a>

source

pub fn new<D: BufferSet>(requested_frames: usize, buffer_set: &'a mut D) -> Self

Create a new ServerRequest object

Create a ServerRequest object representing a request from the server for a buffer requested_frames in size.

When the client responds to this request by calling set_buffer_offset_and_frames, BufferSet::callback will be called on buffer_set.

§Arguments
  • requested_frames - The requested buffer size in frames.
  • buffer_set - The object implementing the callback for when a buffer is provided.
source

pub fn requested_frames(&self) -> usize

Get the number of frames of audio data requested by the server.

The returned value should never be greater than the buffer_size given in new_stream.

source

pub fn set_buffer_offset_and_frames( self, offset: usize, frames: usize ) -> Result<(), BoxError>

Sets the buffer offset and length for the requested buffer.

Sets the buffer offset and length of the buffer that fulfills this server request to offset and length, respectively. This means that length bytes of audio samples may be read from/written to that location in client_shm for a playback/capture stream, respectively. This function may only be called once for a ServerRequest, at which point the ServerRequest is dropped and no further calls are possible.

§Arguments
  • offset - The value to use as the new buffer offset for the next buffer.
  • frames - The length of the next buffer in frames.
§Errors
  • If frames is greater than requested_frames.
source

pub fn ignore_request(self) -> Result<(), BoxError>

Ignore this request

If the client does not intend to respond to this ServerRequest with a buffer, they should call this function. The stream will be notified that the request has been ignored and will handle it properly.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for ServerRequest<'a>

§

impl<'a> !Send for ServerRequest<'a>

§

impl<'a> !Sync for ServerRequest<'a>

§

impl<'a> Unpin for ServerRequest<'a>

§

impl<'a> !UnwindSafe for ServerRequest<'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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.