Skip to main content

ResourceReader

Struct ResourceReader 

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

Reader for Mac OS resource forks (ResourceReader).

Resources are grouped by type, in the order of the type list of the fork.

Implementations§

Source§

impl ResourceReader

Source

pub fn from_bytes(data: &[u8]) -> Result<Self, ResourceError>

Parses a resource fork from its data (ResourceReader(fileobj)).

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self, ResourceError>

Opens a file (ResourceReader(path)): its resource fork where the file system has them (macOS), otherwise the data fork, read as though it were a resource fork.

Source

pub fn get(&self, res_type: &str) -> Option<&[Resource]>

The resources of a type (reader[resType]).

Source

pub fn set(&mut self, res_type: String, resources: Vec<Resource>)

Sets the resources of a type (reader[resType] = resources).

Source

pub fn remove(&mut self, res_type: &str) -> Option<Vec<Resource>>

Removes the resources of a type (del reader[resType]).

Source

pub fn len(&self) -> usize

The number of types (len(reader)).

Source

pub fn is_empty(&self) -> bool

Whether there are no types.

Source

pub fn types(&self) -> Vec<&str>

The types of resources in the fork (keys(), types).

Source

pub fn iter(&self) -> impl Iterator<Item = (&str, &[Resource])>

Iterates over the types and their resources.

Source

pub fn count_resources(&self, res_type: &str) -> usize

The number of resources of a type (countResources).

Source

pub fn get_indices(&self, res_type: &str) -> Vec<usize>

The indices of the resources of a type, from 1 (getIndices).

Source

pub fn get_names(&self, res_type: &str) -> Vec<&str>

The names of the resources of a type that have one (getNames).

Source

pub fn get_ind_resource(&self, res_type: &str, index: i64) -> Option<&Resource>

The resource of a type at an index from 1 (getIndResource).

Source

pub fn get_named_resource( &self, res_type: &str, name: &str, ) -> Option<&Resource>

The resource of a type with a name (getNamedResource).

Trait Implementations§

Source§

impl Clone for ResourceReader

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ResourceReader

Source§

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

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

impl Default for ResourceReader

Source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.