pub enum HintError {
Input(InputError),
BufferTooSmall {
required: usize,
},
}Expand description
A hint cannot be formatted. Both errors leave the caller’s buffer unchanged.
use ferravex_render::input::{ActionKind, Binding, InputCode, PlayerInput};
let mut input = PlayerInput::transient("hint-error");
input.action("jump", "Jump", ActionKind::Button,
vec![Binding::digital(InputCode::Key(32))]).unwrap();
let mut short = [b'?'; 4];
let error = input.format_hint("jump", &mut short).unwrap_err();
assert_eq!(error.to_string(), "hint buffer requires 5 bytes");
assert_eq!(&short, b"????");Variants§
Input(InputError)
An unknown action name produces InputError::InvalidHandle.
BufferTooSmall
Required UTF-8 bytes, without a trailing NUL. No partial label is written.
Trait Implementations§
Source§impl Error for HintError
impl Error for HintError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
impl Copy for HintError
impl Eq for HintError
impl StructuralPartialEq for HintError
Auto Trait Implementations§
impl Freeze for HintError
impl RefUnwindSafe for HintError
impl Send for HintError
impl Sync for HintError
impl Unpin for HintError
impl UnwindSafe for HintError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more