Struct ObjectRequest

Source
pub struct ObjectRequest {
    pub truncate: bool,
    /* private fields */
}
Expand description

Wraps the channel provided in the open methods and provide convenience methods for sending appropriate responses. It also records actions that should be taken upon successful connection such as truncating file objects.

Fields§

§truncate: bool

Truncate the object before use.

Implementations§

Source§

impl ObjectRequest

Source

pub fn new(flags: Flags, options: &Options, object_request: Channel) -> Self

Create a new ObjectRequest from a set of fio::Flags and fio::Options`.

Source

pub fn attributes(&self) -> NodeAttributesQuery

Source

pub fn create_attributes(&self) -> Option<&MutableNodeAttributes>

Source

pub fn options(&self) -> Options

Source

pub async fn into_request_stream<T: Representation>( self, connection: &T, ) -> Result<<T::Protocol as ProtocolMarker>::RequestStream, Status>

Returns the request stream after sending requested information.

Source

pub fn into_server_end<T>(self) -> ServerEnd<T>

Converts to ServerEnd.

Source

pub fn into_channel(self) -> Channel

Extracts the channel (without sending on_open).

Source

pub fn into_channel_after_sending_on_open( self, node_info: NodeInfoDeprecated, ) -> Result<Channel, Status>

Extracts the channel after sending on_open.

Source

pub fn shutdown(self, status: Status)

Terminates the object request with the given status.

Source

pub fn handle<T>( self, f: impl FnOnce(ObjectRequestRef<'_>) -> Result<T, Status>, ) -> Option<T>

Calls f and sends an error on the object request channel upon failure.

Source

pub async fn handle_async( self, f: impl AsyncFnOnce(&mut ObjectRequest) -> Result<(), Status>, )

Calls f and sends an error on the object request channel upon failure.

Source

pub async fn wait_till_ready(&self) -> bool

Waits until the request has a request waiting in its channel. Returns immediately if this request requires sending an initial event such as OnOpen or OnRepresentation. Returns true if the channel is readable (rather than just closed).

Source

pub fn take(&mut self) -> ObjectRequest

Take the ObjectRequest. The caller is responsible for sending errors.

Source

pub async fn create_connection<C, N>( &mut self, scope: ExecutionScope, node: Arc<N>, protocols: impl ProtocolsExt, ) -> Result<(), Status>
where C: ConnectionCreator<N>, N: Node,

Constructs a new connection to node and spawns an async Task that will handle requests on the connection. f is a callback that constructs the connection but it will not be called if the connection is supposed to be a node connection. This should be called from within a ObjectRequest::handle_async callback.

Source

pub fn create_connection_sync<C, N>( self, scope: ExecutionScope, node: Arc<N>, protocols: impl ProtocolsExt, )
where C: ConnectionCreator<N>, N: Node,

Constructs a new connection to node and spawns an async Task that will handle requests on the connection. f is a callback that constructs the connection but it will not be called if the connection is supposed to be a node connection. This should be called from within a ObjectRequest::handle callback.

This method synchronously calls async code and may require spawning an extra Task if the async code does something asynchronous. create_connection should be preferred if the caller is already in an async context.

Trait Implementations§

Source§

impl Debug for ObjectRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. 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> IntoAny for T
where T: 'static + Send + Sync,

Source§

fn into_any(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Cast the given object into a dyn std::any::Any.
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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>,

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V