WriterBackend
Mojo trait 🡭
WriterBackend
Section titled “WriterBackend”Trait for writing bytes to various backends.
Similar to Reader trait but for writing operations.
Implementations provide write_from_buffer() to write bytes
from a buffer to the underlying storage.
Implemented traits
Section titled “Implemented traits”AnyType, ImplicitlyDestructible, Movable
Methods
Section titled “Methods”__init__
Section titled “__init__”def __init__(out self: _Self, *, deinit take: _Self)Move constructor for Movable trait compliance.
Args:
- take (
_Self) - self (
_Self)
Returns:
_Self
write_from_buffer
Section titled “write_from_buffer”def write_from_buffer(mut self: _Self, mut buf: Span[Byte, MutExternalOrigin], amt: Int, pos: Int = 0) -> UInt64Write bytes from a buffer to the underlying storage.
Args:
- self (
_Self) - buf (
Span): Source buffer containing bytes to write. - amt (
Int): Number of bytes to write (must be <= len(buf) - pos). - pos (
Int): Starting position in buf (default 0).
Returns:
UInt64: Number of bytes actually written.
Raises:
Error: If writing fails or parameters are invalid.