pub struct ConsoleVariable<T> { /* private fields */ }Expand description
A console variable, by name: one this library registered, or any other
(the engine’s included), read and written as T.
Implementations§
Source§impl<T> ConsoleVariable<T>where
T: ConsoleValue,
impl<T> ConsoleVariable<T>where
T: ConsoleValue,
Sourcepub const fn new(name: &'static str) -> ConsoleVariable<T>
pub const fn new(name: &'static str) -> ConsoleVariable<T>
The variable name, registered or not.
Sourcepub fn register(&self, help: &str, default: T) -> Result<(), RustealError>
pub fn register(&self, help: &str, default: T) -> Result<(), RustealError>
Register it with its default value: name value in the console sets
it. Fails when the name is already a command or variable.
Sourcepub fn get(&self) -> Result<T, RustealError>
pub fn get(&self) -> Result<T, RustealError>
Its value.
Sourcepub fn set(&self, value: T) -> Result<(), RustealError>
pub fn set(&self, value: T) -> Result<(), RustealError>
Set it, as code does.
Trait Implementations§
Source§impl<T> Clone for ConsoleVariable<T>where
T: Clone,
impl<T> Clone for ConsoleVariable<T>where
T: Clone,
Source§fn clone(&self) -> ConsoleVariable<T>
fn clone(&self) -> ConsoleVariable<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T> Copy for ConsoleVariable<T>where
T: Copy,
Source§impl<T> Debug for ConsoleVariable<T>where
T: Debug,
impl<T> Debug for ConsoleVariable<T>where
T: Debug,
impl<T> Eq for ConsoleVariable<T>where
T: Eq,
Source§impl<T> PartialEq for ConsoleVariable<T>where
T: PartialEq,
impl<T> PartialEq for ConsoleVariable<T>where
T: PartialEq,
impl<T> StructuralPartialEq for ConsoleVariable<T>where
T: PartialEq,
Auto Trait Implementations§
impl<T> Freeze for ConsoleVariable<T>
impl<T> RefUnwindSafe for ConsoleVariable<T>
impl<T> Send for ConsoleVariable<T>
impl<T> Sync for ConsoleVariable<T>
impl<T> Unpin for ConsoleVariable<T>
impl<T> UnsafeUnpin for ConsoleVariable<T>
impl<T> UnwindSafe for ConsoleVariable<T>
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