⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

AssociationRegistry

Struct AssociationRegistry 

Source
pub struct AssociationRegistry { /* private fields */ }
Expand description

Registry of file associations, keyed by extension and MIME type.

Implementations§

Source§

impl AssociationRegistry

Source

pub fn new() -> Self

Create a new empty registry.

Source

pub fn with_defaults() -> Self

Create a registry pre-populated with built-in defaults.

Source

pub fn register(&mut self, assoc: FileAssociation)

Register a file association.

If an association for the same extension or MIME type already exists, the new one replaces it.

Source

pub fn lookup_by_ext(&self, ext: &str) -> Option<&FileAssociation>

Look up an association by file extension (case-insensitive).

Source

pub fn lookup_by_mime(&self, mime: &str) -> Option<&FileAssociation>

Look up an association by MIME type.

Source

pub fn set_default(&mut self, ext: &str, app: &str) -> bool

Set the default application for a given extension.

Source

pub fn get_default(&self, ext: &str) -> Option<&str>

Get the default application for a given extension.

Source

pub fn extension_count(&self) -> usize

Number of registered extensions.

Source

pub fn mime_count(&self) -> usize

Number of registered MIME types.

Source

pub fn get_app_for_file(&self, filename: &str) -> Option<&str>

Get the default app for a filename (extracts extension).

Trait Implementations§

Source§

impl Debug for AssociationRegistry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AssociationRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for AssociationRegistry

§

impl RefUnwindSafe for AssociationRegistry

§

impl Send for AssociationRegistry

§

impl Sync for AssociationRegistry

§

impl Unpin for AssociationRegistry

§

impl UnwindSafe for AssociationRegistry

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.