Struct adnl::AdnlReceiver
source · pub struct AdnlReceiver { /* private fields */ }
Expand description
Low-level incoming datagram processor
Implementations§
source§impl AdnlReceiver
impl AdnlReceiver
sourcepub fn new(aes_params: &AdnlAesParams) -> Self
pub fn new(aes_params: &AdnlAesParams) -> Self
Create receiver with given session parameters
sourcepub async fn receive<R: AsyncReadExt + Unpin, C: AsyncWriteExt + Unpin, const BUFFER: usize>(
&mut self,
transport: &mut R,
consumer: &mut C
) -> Result<(), AdnlError>
pub async fn receive<R: AsyncReadExt + Unpin, C: AsyncWriteExt + Unpin, const BUFFER: usize>( &mut self, transport: &mut R, consumer: &mut C ) -> Result<(), AdnlError>
Receive datagram from transport
. Received parts of the decrypted buffer
will be sent to consumer
, which usually can be just Vec
. Note that
data can be processed before this function will return, but in case of
AdnlError::IntegrityError
you must assume that the data was tampered.
You can adjust BUFFER
according to your memory requirements.
Recommended size is 8192 bytes.
Auto Trait Implementations§
impl RefUnwindSafe for AdnlReceiver
impl Send for AdnlReceiver
impl Sync for AdnlReceiver
impl Unpin for AdnlReceiver
impl UnwindSafe for AdnlReceiver
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