pub struct GetOperation<'a> { /* private fields */ }
Expand description
Represents an in-progress GET Operation.
Example Usage:
let obex_client = ObexClient::new(..);
let get_operation = obex_client.get()?;
// Optionally make request for information about the payload.
let initial_headers: HeaderSet = ...;
let received_headers = get_operation.get_information(initial_headers).await?;
// Process `received_headers` and make a subsequent request for more information.
let additional_headers: HeaderSet = ...;
let additional_received_headers = get_operation.get_information(additional_headers).await?;
// Make the "final" request to get data.
let body = get_operation.get_data(HeaderSet::new()).await?;
// Process `body` - `get_operation` is consumed and the operation is assumed to be complete.
Implementations§
Source§impl<'a> GetOperation<'a>
impl<'a> GetOperation<'a>
pub fn new(headers: HeaderSet, transport: ObexTransport<'a>) -> Self
Sourcepub async fn get_information(
&mut self,
headers: HeaderSet,
) -> Result<HeaderSet, Error>
pub async fn get_information( &mut self, headers: HeaderSet, ) -> Result<HeaderSet, Error>
Request information about the payload. Returns the informational headers from the peer response on success, Error otherwise.
Only one such request can be outstanding at a time. headers
must be nonempty. If no
additional information is needed, use GetOperation::get_data
instead.
Sourcepub async fn get_data(self, headers: HeaderSet) -> Result<Vec<u8>, Error>
pub async fn get_data(self, headers: HeaderSet) -> Result<Vec<u8>, Error>
Request the user data payload from the remote OBEX server. Returns the byte payload on success, Error otherwise.
The GET operation is considered complete after this.
Sourcepub async fn terminate(self, headers: HeaderSet) -> Result<HeaderSet, Error>
pub async fn terminate(self, headers: HeaderSet) -> Result<HeaderSet, Error>
Request to terminate a multi-packet GET request early. Returns the informational headers from the peer response on success, Error otherwise. If Error is returned, there are no guarantees about the synchronization between the local OBEX client and remote OBEX server.