Skip to main content

llama_cpp_bindings/error/
token_to_string_error.rs

1use std::os::raw::c_int;
2use std::string::FromUtf8Error;
3
4/// An error that can occur when converting a token to a string.
5#[derive(Debug, thiserror::Error, Clone)]
6#[non_exhaustive]
7pub enum TokenToStringError {
8    /// the token type was unknown
9    #[error("Unknown Token Type")]
10    UnknownTokenType,
11    /// There was insufficient buffer space to convert the token to a string.
12    #[error("Insufficient Buffer Space {0}")]
13    InsufficientBufferSpace(c_int),
14    /// The token was not valid utf8.
15    #[error("FromUtf8Error {0}")]
16    FromUtf8Error(#[from] FromUtf8Error),
17    /// An integer conversion failed.
18    #[error("Integer conversion error: {0}")]
19    IntConversionError(#[from] std::num::TryFromIntError),
20}