diff --git a/wfassoc/src/components.rs b/wfassoc/src/components.rs new file mode 100644 index 0000000..6738297 --- /dev/null +++ b/wfassoc/src/components.rs @@ -0,0 +1,41 @@ +/// The struct representing an Windows acceptable Prgram ID, +/// which looks like `Program.Document.2` +pub struct ProgId { + inner: String, +} + +impl ProgId { + pub fn new(prog_id: &str) -> Self { + Self { + inner: prog_id.to_string(), + } + } +} + +/// Representing an file extension which must start with dot (`.`) +/// and followed by arbitrary characters. +pub struct FileExt { + inner: String, +} + +impl FileExt { + pub fn new(file_ext: &str) -> Self { + Self { + inner: file_ext.to_string(), + } + } +} + +/// Representing an Windows recognizable icon string with format like: +/// `@path_to_file.exe,61`. +pub struct WinRc { + inner: String, +} + +impl WinRc { + pub fn new(icon: &str) -> Self { + Self { + inner: icon.to_string(), + } + } +} diff --git a/wfassoc/src/lib.rs b/wfassoc/src/lib.rs index 006a715..b914ec9 100644 --- a/wfassoc/src/lib.rs +++ b/wfassoc/src/lib.rs @@ -1,6 +1,9 @@ #[cfg(not(target_os = "windows"))] compile_error!("Crate wfassoc is only supported on Windows."); +pub(crate) mod components; +pub(crate) mod program; + pub fn add(left: u64, right: u64) -> u64 { left + right } diff --git a/wfassoc/src/program.rs b/wfassoc/src/program.rs new file mode 100644 index 0000000..8670b0d --- /dev/null +++ b/wfassoc/src/program.rs @@ -0,0 +1,17 @@ +use super::components::*; + +pub struct Program { + name: String, + prog_id: ProgId, + file_exts: Vec, +} + +impl Program { + pub fn new() -> Self { + Self { + name: String::new(), + prog_id: ProgId::new(""), + file_exts: Vec::new(), + } + } +}