sftp-protocol 0.1.0

A pure Rust implementation of the SFTP protocol
Documentation
use camino::Utf8Path;
use camino::Utf8PathBuf;
use time::OffsetDateTime;

#[derive(Clone, Debug)]
pub struct Metadata {
	pub path: Utf8PathBuf,
	pub size: u64,
	pub is_dir: bool,
	pub is_file: bool,
	pub link_target: Option<Utf8PathBuf>,
	pub uid: u32,
	pub gid: u32,
	pub permissions: u32,
	pub atime: OffsetDateTime,
	pub mtime: OffsetDateTime
}

impl Metadata {
	#[allow(clippy::too_many_arguments)]
	pub fn new(path: &Utf8Path, size: u64, is_dir: bool, is_file: bool, link_target: Option<&Utf8Path>, uid: u32, gid: u32, permissions: u32, atime: impl Into<OffsetDateTime>, mtime: impl Into<OffsetDateTime>) -> Self {
		Self{
			path: path.to_path_buf(),
			size,
			is_dir,
			is_file,
			link_target: link_target.map(Utf8PathBuf::from),
			uid,
			gid,
			permissions,
			atime: atime.into(),
			mtime: mtime.into()
		}
	}
}