pub struct Packet<T>{ /* private fields */ }
Expand description
An OBEX Packet that can be encoded/decoded to/from a raw byte buffer. This is sent over the L2CAP or RFCOMM transport.
Implementations§
Source§impl<T> Packet<T>
impl<T> Packet<T>
Sourcepub const MIN_PACKET_SIZE: usize = 3usize
pub const MIN_PACKET_SIZE: usize = 3usize
The minimum packet consists of an opcode (1 byte) and packet length (2 bytes).
pub fn new(code: T, data: Vec<u8>, headers: HeaderSet) -> Self
pub fn code(&self) -> &T
pub fn data(&self) -> &Vec<u8> ⓘ
pub fn headers(&self) -> &HeaderSet
Source§impl Packet<OpCode>
impl Packet<OpCode>
Sourcepub fn new_connect(max_packet_size: u16, headers: HeaderSet) -> Self
pub fn new_connect(max_packet_size: u16, headers: HeaderSet) -> Self
Returns a CONNECT request packet with the provided headers
.
pub fn new_disconnect(headers: HeaderSet) -> Self
pub fn new_get(headers: HeaderSet) -> Self
pub fn new_get_final(headers: HeaderSet) -> Self
pub fn new_put(headers: HeaderSet) -> Self
pub fn new_put_final(headers: HeaderSet) -> Self
pub fn new_set_path( flags: SetPathFlags, headers: HeaderSet, ) -> Result<Self, Error>
pub fn new_abort(headers: HeaderSet) -> Self
Source§impl Packet<ResponseCode>
impl Packet<ResponseCode>
pub fn new_no_data(code: ResponseCode, headers: HeaderSet) -> Self
pub fn new_connect( code: ResponseCode, max_packet_size: u16, headers: HeaderSet, ) -> Self
pub fn new_disconnect(headers: HeaderSet) -> Self
pub fn new_setpath(code: ResponseCode, headers: HeaderSet) -> Self
pub fn new_get(code: ResponseCode, headers: HeaderSet) -> Self
pub fn expect_code( self, request: OpCode, expected: ResponseCode, ) -> Result<Self, Error>
Trait Implementations§
Source§impl<T> Encodable for Packet<T>
impl<T> Encodable for Packet<T>
impl<T> StructuralPartialEq for Packet<T>
Auto Trait Implementations§
impl<T> Freeze for Packet<T>
impl<T> RefUnwindSafe for Packet<T>
impl<T> Send for Packet<T>
impl<T> Sync for Packet<T>
impl<T> Unpin for Packet<T>
impl<T> UnwindSafe for Packet<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)