Skip to main content

SectionFile

Struct SectionFile 

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

In-memory TSDuck section-file container.

SectionFile is !Send + !Sync. Its native owner is dropped before the retained DuckContext, preserving the native borrowed-context lifetime.

Implementations§

Source§

impl SectionFile

Source

pub fn new(duck: Rc<DuckContext>) -> Result<Self>

Creates an empty section-file container borrowing duck.

Source

pub fn duck_context(&self) -> &Rc<DuckContext>

Returns the retained context.

Source

pub fn clear(&mut self) -> Result<()>

Clears all loaded sections.

Source

pub fn binary_size(&self) -> Result<usize>

Returns serialized binary size in bytes.

Source

pub fn sections_count(&self) -> Result<usize>

Returns the number of sections.

Source

pub fn tables_count(&self) -> Result<usize>

Returns the number of tables.

Source

pub fn set_crc_validation(&mut self, mode: CrcValidation) -> Result<()>

Sets CRC handling for subsequent binary loads.

Source

pub fn load_binary_buffer(&mut self, data: &[u8]) -> Result<()>

Loads binary sections from memory.

Source

pub fn to_binary(&self) -> Result<Vec<u8>>

Serializes all sections as binary data.

Source

pub fn load_binary(&mut self, path: &Path) -> Result<()>

Loads binary sections from a filesystem path.

Source

pub fn save_binary(&self, path: &Path) -> Result<()>

Saves binary sections to a filesystem path.

Source

pub fn load_xml(&mut self, source: &str) -> Result<()>

Loads XML from a file path or inline XML document accepted by TSDuck.

Source

pub fn save_xml(&self, path: &Path) -> Result<()>

Saves XML to a filesystem path.

Source

pub fn save_json(&self, path: &Path) -> Result<()>

Saves JSON to a filesystem path.

Source

pub fn to_xml(&self) -> Result<String>

Serializes the container as XML.

Source

pub fn to_json(&self) -> Result<String>

Serializes the container as JSON.

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> 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, 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.