#[non_exhaustive]pub enum SessionError {
TooLong {
len: usize,
limit: usize,
},
SpaceExhausted {
needed: u64,
available: u64,
},
}Expand description
The reason a Session could not accept a line.
Both variants mean the pending entry was too large to keep, so the session discards it before returning the error: the next line starts a fresh entry and the session stays usable. Nothing already committed is affected. The pipeline is never called with input that triggered an error.
The enum is #[non_exhaustive]; match it with a wildcard arm.
§Examples
use repl_lang::{Session, SessionError, Status};
let mut session = Session::with_limit(8);
let err = session.feed("a line that is far too long", |_| Status::Complete(())).unwrap_err();
assert!(matches!(err, SessionError::TooLong { limit: 8, .. }));
assert!(!session.is_pending()); // the oversized entry was droppedVariants (Non-exhaustive)§
This enum is marked as non-exhaustive
TooLong
The entry, with this line added, would exceed the session’s size limit.
The limit bounds how much text one entry can accumulate — and so how
much the pipeline re-reads on every continuation line — guarding
against a runaway paste or a pipeline that never declares input
complete. Report it to the user; raise the limit with
Session::with_limit if legitimate
entries hit it.
Fields
SpaceExhausted
The session’s source map has no room left for the entry.
Committed entries share one 32-bit position space, so a session can hold
about 4 GiB of entries in total. A shorter entry may still fit, but the
session is effectively full: start a fresh Session.
Trait Implementations§
Source§impl Clone for SessionError
impl Clone for SessionError
Source§impl Debug for SessionError
impl Debug for SessionError
Source§impl Display for SessionError
impl Display for SessionError
impl Eq for SessionError
Source§impl Error for SessionError
impl Error for SessionError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()