pub struct TftpBuilder { /* private fields */ }Expand description
Builder for TFTP packets.
Implementations§
Source§impl TftpBuilder
impl TftpBuilder
pub fn new() -> Self
Sourcepub fn rrq(self, filename: impl Into<Vec<u8>>, mode: impl Into<Vec<u8>>) -> Self
pub fn rrq(self, filename: impl Into<Vec<u8>>, mode: impl Into<Vec<u8>>) -> Self
Build a Read Request (RRQ) packet.
Mode is typically “netascii”, “octet”, or “mail”.
Sourcepub fn wrq(self, filename: impl Into<Vec<u8>>, mode: impl Into<Vec<u8>>) -> Self
pub fn wrq(self, filename: impl Into<Vec<u8>>, mode: impl Into<Vec<u8>>) -> Self
Build a Write Request (WRQ) packet.
Sourcepub fn data(self, block_num: u16, payload: impl Into<Vec<u8>>) -> Self
pub fn data(self, block_num: u16, payload: impl Into<Vec<u8>>) -> Self
Build a DATA packet with the given block number and payload.
Sourcepub fn error_file_not_found(self) -> Self
pub fn error_file_not_found(self) -> Self
Build “File not found” error (code 1).
Sourcepub fn error_access_violation(self) -> Self
pub fn error_access_violation(self) -> Self
Build “Access violation” error (code 2).
Sourcepub fn error_disk_full(self) -> Self
pub fn error_disk_full(self) -> Self
Build “Disk full” error (code 3).
Sourcepub fn error_illegal_op(self) -> Self
pub fn error_illegal_op(self) -> Self
Build “Illegal operation” error (code 4).
Sourcepub fn error_file_exists(self) -> Self
pub fn error_file_exists(self) -> Self
Build “File already exists” error (code 6).
Trait Implementations§
Source§impl Clone for TftpBuilder
impl Clone for TftpBuilder
Source§fn clone(&self) -> TftpBuilder
fn clone(&self) -> TftpBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TftpBuilder
impl Debug for TftpBuilder
Auto Trait Implementations§
impl Freeze for TftpBuilder
impl RefUnwindSafe for TftpBuilder
impl Send for TftpBuilder
impl Sync for TftpBuilder
impl Unpin for TftpBuilder
impl UnsafeUnpin for TftpBuilder
impl UnwindSafe for TftpBuilder
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§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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