Skip to main content

AltiumCfb

Struct AltiumCfb 

Source
pub struct AltiumCfb<R: Read + Seek> { /* private fields */ }
Expand description

Wrapper around CFB providing Altium-specific convenience methods.

This is Layer 1 of the API, providing low-level access to the CFB container with helpers for reverse engineering and exploration.

Implementations§

Source§

impl AltiumCfb<File>

Source

pub fn open_file<P: AsRef<Path>>(path: P) -> Result<Self>

Opens a CFB file by path.

Source§

impl<R: Read + Seek> AltiumCfb<R>

Source

pub fn open(reader: R) -> Result<Self>

Opens a CFB from a reader.

Source

pub fn file_type(&self) -> AltiumFileType

Returns the detected file type.

Source

pub fn exists(&mut self, path: &str) -> bool

Returns true if the given path exists in the CFB.

Source

pub fn streams(&mut self) -> Result<Vec<StreamInfo>>

Lists all streams in the CFB container.

Source

pub fn storages(&mut self) -> Result<Vec<StorageInfo>>

Lists all storages (directories) in the CFB container.

Source

pub fn section_keys(&mut self) -> Result<&HashMap<String, String>>

Loads and caches section keys mapping (LIBREF → storage path).

Section keys map full component names to truncated storage paths, which is necessary because CFB has a 31-character limit on entry names.

Source

pub fn resolve_section(&mut self, lib_ref: &str) -> Result<String>

Resolves a component/footprint name to its storage path.

For names ≤31 chars without ‘/’, returns the name directly. For longer names or names with ‘/’, looks up in section keys.

Source

pub fn list_components(&mut self) -> Result<Vec<String>>

Lists all component/footprint names in a library file.

Source

pub fn read_stream(&mut self, path: &str) -> Result<Vec<u8>>

Reads raw bytes from a stream.

Source

pub fn read_params(&mut self, path: &str) -> Result<ParameterCollection>

Reads a stream and parses it as a single ParameterCollection.

Source

pub fn read_blocks(&mut self, path: &str) -> Result<Vec<Block>>

Reads a stream as size-prefixed blocks.

Source

pub fn parse_blocks(data: &[u8]) -> Result<Vec<Block>>

Parses raw data as size-prefixed blocks.

Source

pub fn decompress(&mut self, path: &str) -> Result<Vec<u8>>

Decompresses a zlib-compressed stream.

Source

pub fn decompress_at(&mut self, path: &str, offset: usize) -> Result<Vec<u8>>

Decompresses data starting at a given offset.

Source

pub fn hexdump( &mut self, path: &str, offset: usize, length: usize, width: usize, ) -> Result<String>

Generates a hexdump of stream content.

Source

pub fn find_strings( &mut self, path: &str, min_length: usize, ) -> Result<Vec<FoundString>>

Finds printable strings in a stream.

Source

pub fn search( &mut self, pattern: &str, ignore_case: bool, ) -> Result<Vec<SearchMatch>>

Searches for a pattern across all streams.

Source

pub fn inner(&mut self) -> &mut CompoundFile<R>

Returns mutable access to the underlying CompoundFile.

Use this for advanced operations not covered by the wrapper.

Source

pub fn inner_ref(&self) -> &CompoundFile<R>

Returns immutable access to the underlying CompoundFile.

Source

pub fn version(&self) -> Version

Returns the CFB format version.

Source

pub fn entry_type(&mut self, path: &str) -> Option<bool>

Checks if a path exists and returns whether it’s a stream.

Returns Some(true) if the path is a stream, Some(false) if it’s a storage, None if the path doesn’t exist.

Source

pub fn stream_size(&mut self, path: &str) -> Option<u64>

Returns the size of a stream, or None if the path doesn’t exist or isn’t a stream.

Source

pub fn entries(&mut self) -> Vec<(String, bool, u64)>

Returns an iterator over all entries in the CFB, yielding (path, is_stream, size).

Auto Trait Implementations§

§

impl<R> Freeze for AltiumCfb<R>

§

impl<R> RefUnwindSafe for AltiumCfb<R>

§

impl<R> Send for AltiumCfb<R>
where R: Send + Sync,

§

impl<R> Sync for AltiumCfb<R>
where R: Send + Sync,

§

impl<R> Unpin for AltiumCfb<R>

§

impl<R> UnwindSafe for AltiumCfb<R>

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

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

Source§

type Error = Infallible

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

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

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.
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool