pub struct OutgoingFile {
pub id: String,
pub path: PathBuf,
pub file_name: String,
pub size: u64,
pub file_type: String,
pub sha256: Option<String>,
}Expand description
Specification for a file to be sent to a remote peer.
Fields§
§id: StringUnique client-side ID for this file in the session.
path: PathBufAbsolute path to the file on local disk.
file_name: StringName to advertise to the remote receiver (defaults to file basename).
size: u64Size of the file in bytes.
file_type: StringMIME type string (e.g. application/octet-stream).
sha256: Option<String>Precomputed or lazily computed SHA-256 hash (hex string).
Implementations§
Source§impl OutgoingFile
impl OutgoingFile
Sourcepub async fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, ClientError>
pub async fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, ClientError>
Creates an OutgoingFile from a local file path.
Reads file metadata to obtain size. Basename is derived automatically.
Sourcepub async fn from_path_with_name<P: AsRef<Path>>(
path: P,
file_name: String,
) -> Result<Self, ClientError>
pub async fn from_path_with_name<P: AsRef<Path>>( path: P, file_name: String, ) -> Result<Self, ClientError>
Creates an OutgoingFile from a local file path with custom relative advertised file_name.
Sourcepub async fn with_computed_sha256(self) -> Result<Self, ClientError>
pub async fn with_computed_sha256(self) -> Result<Self, ClientError>
Computes and populates the SHA-256 hash of the local file.
Trait Implementations§
Source§impl Clone for OutgoingFile
impl Clone for OutgoingFile
Auto Trait Implementations§
impl Freeze for OutgoingFile
impl RefUnwindSafe for OutgoingFile
impl Send for OutgoingFile
impl Sync for OutgoingFile
impl Unpin for OutgoingFile
impl UnsafeUnpin for OutgoingFile
impl UnwindSafe for OutgoingFile
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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