#[non_exhaustive]pub struct FileAssociation {
pub extensions: Vec<String>,
pub mime_type: Option<String>,
pub description: Option<String>,
pub name: Option<String>,
pub role: BundleTypeRole,
}Expand description
A file association configuration.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.extensions: Vec<String>File extensions to associate with this app. e.g. ‘png’
mime_type: Option<String>The mime-type e.g. ‘image/png’ or ‘text/plain’. Linux-only.
description: Option<String>The association description. Windows-only. It is displayed on the Type column on Windows Explorer.
name: Option<String>The name. Maps to CFBundleTypeName on macOS. Defaults to the first item in ext
role: BundleTypeRoleThe app’s role with respect to the type. Maps to CFBundleTypeRole on macOS.
Defaults to BundleTypeRole::Editor
Implementations§
Source§impl FileAssociation
impl FileAssociation
Sourcepub fn new<I, S>(extensions: I) -> Self
pub fn new<I, S>(extensions: I) -> Self
Creates a new FileAssociation using provided extensions.
Sourcepub fn extensions<I, S>(self, extensions: I) -> Self
pub fn extensions<I, S>(self, extensions: I) -> Self
Set the extenstions to associate with this app. e.g. ‘png’.
Sourcepub fn mime_type<S: Into<String>>(self, mime_type: S) -> Self
pub fn mime_type<S: Into<String>>(self, mime_type: S) -> Self
Set the mime-type e.g. ‘image/png’ or ‘text/plain’. Linux-only.
Sourcepub fn description<S: Into<String>>(self, description: S) -> Self
pub fn description<S: Into<String>>(self, description: S) -> Self
Se the association description. Windows-only. It is displayed on the Type column on Windows Explorer.
Sourcepub fn name<S: Into<String>>(self, name: S) -> Self
pub fn name<S: Into<String>>(self, name: S) -> Self
Set he name. Maps to CFBundleTypeName on macOS. Defaults to the first item in ext
Sourcepub fn role(self, role: BundleTypeRole) -> Self
pub fn role(self, role: BundleTypeRole) -> Self
Set he app’s role with respect to the type. Maps to CFBundleTypeRole on macOS.
Defaults to BundleTypeRole::Editor
Trait Implementations§
Source§impl Clone for FileAssociation
impl Clone for FileAssociation
Source§fn clone(&self) -> FileAssociation
fn clone(&self) -> FileAssociation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FileAssociation
impl Debug for FileAssociation
Source§impl<'de> Deserialize<'de> for FileAssociation
impl<'de> Deserialize<'de> for FileAssociation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for FileAssociation
impl PartialEq for FileAssociation
Source§impl Serialize for FileAssociation
impl Serialize for FileAssociation
impl Eq for FileAssociation
impl StructuralPartialEq for FileAssociation
Auto Trait Implementations§
impl Freeze for FileAssociation
impl RefUnwindSafe for FileAssociation
impl Send for FileAssociation
impl Sync for FileAssociation
impl Unpin for FileAssociation
impl UnwindSafe for FileAssociation
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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