morpheus_network::transfer::disk::writer

Struct IsoWriter

Source
pub struct IsoWriter {
    state: WriterState,
    chunks: ChunkSet,
    fat32_info: [Option<Fat32Info>; 16],
    current_chunk: usize,
    chunk_bytes: u64,
    total_bytes: u64,
    total_size: u64,
    chunk_size: u64,
    iso_name: [u8; 64],
    name_len: usize,
    progress_fn: Option<fn(bytes_written: u64, total_bytes: u64, chunk: usize, total_chunks: usize)>,
}
Expand description

Streaming ISO writer

Handles partition creation, FAT32 formatting, and data writing.

Fields§

§state: WriterState

Current state

§chunks: ChunkSet

Chunk partitions

§fat32_info: [Option<Fat32Info>; 16]

FAT32 info for each chunk

§current_chunk: usize

Current chunk being written

§chunk_bytes: u64

Bytes written to current chunk

§total_bytes: u64

Total bytes written

§total_size: u64

Target total size

§chunk_size: u64

Chunk size limit

§iso_name: [u8; 64]

ISO name

§name_len: usize

Name length

§progress_fn: Option<fn(bytes_written: u64, total_bytes: u64, chunk: usize, total_chunks: usize)>

Progress callback

Implementations§

Source§

impl IsoWriter

Source

pub fn new(iso_name: &str, total_size: u64) -> Self

Create new writer for ISO of given size

Source

pub fn set_progress( &mut self, f: fn(bytes_written: u64, total_bytes: u64, chunk: usize, total_chunks: usize), )

Set progress callback

Source

pub fn state(&self) -> WriterState

Get current state

Source

pub fn bytes_written(&self) -> u64

Get bytes written

Source

pub fn chunks(&self) -> &ChunkSet

Get chunk info

Source

pub fn initialize<B: BlockIo>(&mut self, block_io: &mut B) -> DiskResult<()>

Initialize writer: create partitions and format FAT32

Call this before writing any data.

Source

pub fn initialize_with_partitions( &mut self, partitions: &[(u64, u64)], fat32_infos: &[Fat32Info], ) -> DiskResult<()>

Initialize with pre-existing partitions

Use this if partitions were created earlier (e.g., pre-EBS).

Source

pub fn write<B: BlockIo>( &mut self, block_io: &mut B, data: &[u8], ) -> DiskResult<usize>

Write data to ISO

Handles chunk boundaries automatically.

Source

fn write_sectors<B: BlockIo>( &self, block_io: &mut B, start_lba: u64, data: &[u8], ) -> DiskResult<()>

Write sectors to disk

Source

pub fn finalize<B: BlockIo>(&mut self, block_io: &mut B) -> DiskResult<()>

Finalize writing and flush

Source

fn chunk_name_str<'a>(&self, index: usize, buf: &'a mut [u8; 16]) -> &'a str

Generate chunk partition name as str

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