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
impl ResourceReader
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, ResourceError>
pub fn from_bytes(data: &[u8]) -> Result<Self, ResourceError>
Parses a resource fork from its data (ResourceReader(fileobj)).
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self, ResourceError>
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.
Sourcepub fn get(&self, res_type: &str) -> Option<&[Resource]>
pub fn get(&self, res_type: &str) -> Option<&[Resource]>
The resources of a type (reader[resType]).
Sourcepub fn set(&mut self, res_type: String, resources: Vec<Resource>)
pub fn set(&mut self, res_type: String, resources: Vec<Resource>)
Sets the resources of a type (reader[resType] = resources).
Sourcepub fn remove(&mut self, res_type: &str) -> Option<Vec<Resource>>
pub fn remove(&mut self, res_type: &str) -> Option<Vec<Resource>>
Removes the resources of a type (del reader[resType]).
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, &[Resource])>
pub fn iter(&self) -> impl Iterator<Item = (&str, &[Resource])>
Iterates over the types and their resources.
Sourcepub fn count_resources(&self, res_type: &str) -> usize
pub fn count_resources(&self, res_type: &str) -> usize
The number of resources of a type (countResources).
Sourcepub fn get_indices(&self, res_type: &str) -> Vec<usize>
pub fn get_indices(&self, res_type: &str) -> Vec<usize>
The indices of the resources of a type, from 1 (getIndices).
Sourcepub fn get_names(&self, res_type: &str) -> Vec<&str>
pub fn get_names(&self, res_type: &str) -> Vec<&str>
The names of the resources of a type that have one (getNames).
Trait Implementations§
Source§impl Clone for ResourceReader
impl Clone for ResourceReader
Source§impl Debug for ResourceReader
impl Debug for ResourceReader
Auto Trait Implementations§
impl Forget for ResourceReader
impl Freeze for ResourceReader
impl Move for ResourceReader
impl RefUnwindSafe for ResourceReader
impl Send for ResourceReader
impl Sync for ResourceReader
impl Unpin for ResourceReader
impl UnsafeUnpin for ResourceReaderwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<usize>: UnsafeUnpin,
PhantomData<Bucket<String, Vec<Resource>>>: UnsafeUnpin,
impl UnwindSafe for ResourceReader
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
Mutably borrows from an owned value. Read more