Type Alias RequestPacket

Source
pub type RequestPacket = Packet<OpCode>;
Expand description

An OBEX request packet. Defined in OBEX 1.5 Section 3.1.

Aliased Type§

struct RequestPacket { /* private fields */ }

Implementations§

Source§

impl RequestPacket

Source

pub fn new_connect(max_packet_size: u16, headers: HeaderSet) -> Self

Returns a CONNECT request packet with the provided headers.

Source

pub fn new_disconnect(headers: HeaderSet) -> Self

Source

pub fn new_get(headers: HeaderSet) -> Self

Source

pub fn new_get_final(headers: HeaderSet) -> Self

Source

pub fn new_put(headers: HeaderSet) -> Self

Source

pub fn new_put_final(headers: HeaderSet) -> Self

Source

pub fn new_set_path( flags: SetPathFlags, headers: HeaderSet, ) -> Result<Self, Error>

Source

pub fn new_abort(headers: HeaderSet) -> Self

Source§

impl<T> Packet<T>
where T: Clone + Debug + PartialEq, for<'a> &'a T: Into<u8>,

Source

pub const MIN_PACKET_SIZE: usize = 3usize

The minimum packet consists of an opcode (1 byte) and packet length (2 bytes).

Source

pub fn new(code: T, data: Vec<u8>, headers: HeaderSet) -> Self

Source

pub fn code(&self) -> &T

Source

pub fn data(&self) -> &Vec<u8>

Source

pub fn headers(&self) -> &HeaderSet

Trait Implementations§

Source§

impl Decodable for RequestPacket

Source§

type Error = PacketError

Source§

fn decode(buf: &[u8]) -> Result<Self, Self::Error>

Decodes into a new object, or returns an error.
Source§

impl<T> Clone for Packet<T>
where T: Clone + Debug + PartialEq + Clone, for<'a> &'a T: Into<u8>,

Source§

fn clone(&self) -> Packet<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for Packet<T>
where T: Clone + Debug + PartialEq + Debug, for<'a> &'a T: Into<u8>,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T> Encodable for Packet<T>
where T: Clone + Debug + PartialEq, for<'a> &'a T: Into<u8>,

Source§

type Error = PacketError

Source§

fn encoded_len(&self) -> usize

Returns the number of bytes necessary to encode |self|.
Source§

fn encode(&self, buf: &mut [u8]) -> Result<(), Self::Error>

Writes the encoded version of |self| at the start of |buf|. |buf| must be at least |self.encoded_len()| length.
Source§

impl<T> PartialEq for Packet<T>
where T: Clone + Debug + PartialEq + PartialEq, for<'a> &'a T: Into<u8>,

Source§

fn eq(&self, other: &Packet<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> StructuralPartialEq for Packet<T>
where T: Clone + Debug + PartialEq, for<'a> &'a T: Into<u8>,