[][src]Struct hl_capture::cvar::CVar

pub struct CVar {
    pub engine_cvar: *mut cvar_t,
    pub default_value: &'static str,
    pub name: &'static str,
}

Safe wrapper for the engine CVar type.

Fields

engine_cvar: *mut cvar_t

This field has to be public because there's no const fn. It shouldn't be accessed manually.

default_value: &'static str

This field has to be public because there's no const fn. It shouldn't be accessed manually.

name: &'static str

This field has to be public because there's no const fn. It shouldn't be accessed manually.

Methods

impl CVar[src]

pub unsafe fn get_engine_cvar(&self) -> &'static mut cvar_t[src]

Retrieves a mutable reference to the engine CVar.

Safety

Unsafe because this function should only be called from the main game thread. You should also ensure that you don't call any engine functions while holding this reference, because the game also has a mutable reference to this CVar.

pub fn register(&self, engine: &mut Engine) -> Result<(), Error>[src]

Registers this console variable.

pub fn to_string(&self, engine: &mut Engine) -> Result<String, Error>[src]

Returns the string this variable is set to.

pub fn parse<T>(&self, engine: &mut Engine) -> Result<T, Error> where
    T: FromStr,
    <T as FromStr>::Err: Fail, 
[src]

Tries parsing this variable's value to the desired type.

Trait Implementations

impl Sync for CVar[src]

impl Send for CVar[src]

Auto Trait Implementations

impl Unpin for CVar

impl RefUnwindSafe for CVar

impl UnwindSafe for CVar

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]