Skip to main content

LiteralReader

Trait LiteralReader 

Source
pub trait LiteralReader: Send {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn metadata(&self) -> LiteralMetadata<&str>;
    fn read(
        &mut self,
        output: &mut [u8],
    ) -> impl Future<Output = Result<usize, Self::Error>> + Send;
    fn is_cancelled(&self) -> bool;
}
Expand description

One immutable literal’s metadata and independently streamed UTF-8 payload.

Opening this reader is adapter-owned: retain exact source term identity and graph occurrence separately. Metadata access is pure and must not read the lexical payload. Implementations may borrow metadata without allocating it.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Backend payload-read failure.

Required Methods§

Source

fn metadata(&self) -> LiteralMetadata<&str>

Borrow standard metadata, including original language spelling/direction.

Source

fn read( &mut self, output: &mut [u8], ) -> impl Future<Output = Result<usize, Self::Error>> + Send

Fill at most the supplied buffer, returning zero only at successful EOF.

UTF-8 scalars may straddle reads. Errors and cancellation must never be disguised as EOF; drop must release/cancel the underlying read.

Source

fn is_cancelled(&self) -> bool

Whether the enclosing inference attempt was cancelled or superseded.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§