Skip to main content

FttsqStreamingWriter

Struct FttsqStreamingWriter 

Source
pub struct FttsqStreamingWriter<W> { /* private fields */ }
Expand description

A bounded writer for .fttsq section payloads.

The stream owns metadata plus one incremental SHA-256 state; it never owns a section payload. This is intentionally lower-level than FttsqWriter: callers retain responsibility for the surrounding atomic temporary-file creation, sync, and rename, while this type finalizes the directory only after every declared byte and digest is complete.

Implementations§

Source§

impl<W: Write + Seek> FttsqStreamingWriter<W>

Source

pub fn write_section( &mut self, section: &str, bytes: &[u8], ) -> Result<(), FttsqError>

Appends bytes to the next declared section.

Calls for a later section are refused rather than buffered. That ordering makes the converter’s one-tensor-at-a-time memory bound mechanical: once a section is complete, its source mapping and tile buffers can be released before conversion continues.

§Errors

Returns a named refusal for out-of-order or overlong sections, or FttsqError::Io when the caller-owned stream cannot accept the bytes.

Source

pub fn finish(self) -> Result<W, FttsqError>

Finalizes all completed section digests and rewrites the reserved directory in place.

The returned stream is positioned at its end and flushed, ready for a file-owning caller to perform its durability and atomic-rename steps. A successful return guarantees that a complete byte buffer collected from the stream passes FttsqReader::open.

§Errors

Refuses an incomplete declared section and names failures while seeking, finalizing, or flushing the caller-owned stream.

Trait Implementations§

Source§

impl<W: Debug> Debug for FttsqStreamingWriter<W>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<W> Freeze for FttsqStreamingWriter<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for FttsqStreamingWriter<W>
where W: RefUnwindSafe,

§

impl<W> Send for FttsqStreamingWriter<W>
where W: Send,

§

impl<W> Sync for FttsqStreamingWriter<W>
where W: Sync,

§

impl<W> Unpin for FttsqStreamingWriter<W>
where W: Unpin,

§

impl<W> UnsafeUnpin for FttsqStreamingWriter<W>
where W: UnsafeUnpin,

§

impl<W> UnwindSafe for FttsqStreamingWriter<W>
where W: UnwindSafe,

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.