Struct Object

Source
#[repr(C)]
pub struct Object { /* private fields */ }
Expand description

Binding to a Neovim object.

Represents any valid Neovim type.

Implementations§

Source§

impl Object

Source

pub fn nil() -> Self

Returns a new nil object.

Source

pub fn is_nil(&self) -> bool

Source

pub fn is_some(&self) -> bool

Source

pub fn from_luaref(luaref: LuaRef) -> Self

Source

pub fn kind(&self) -> ObjectKind

Source

pub unsafe fn as_boolean_unchecked(&self) -> bool

Returns the boolean stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be a Boolean. Calling this method on an Object with any other kind may result in undefined behavior.

Source

pub unsafe fn as_boolean_unchecked_mut(&mut self) -> &mut bool

Returns a mutable reference to the boolean stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be a Boolean. Calling this method on an Object with any other kind may result in undefined behavior.

Source

pub unsafe fn as_integer_unchecked(&self) -> Integer

Returns the integer stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be one of Integer, Buffer, Window, or TabPage. Calling this method on an Object with any other kind may result in undefined behavior.

Source

pub unsafe fn as_integer_unchecked_mut(&mut self) -> &mut Integer

Returns a mutable reference to the integer stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be one of Integer, Buffer, Window, or TabPage. Calling this method on an Object with any other kind may result in undefined behavior.

Source

pub unsafe fn as_float_unchecked(&self) -> Float

Returns the float stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be a Float. Calling this method on an Object with any other kind may result in undefined behavior.

Source

pub unsafe fn as_float_unchecked_mut(&mut self) -> &mut Float

Returns a mutable reference to the float stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be a Float. Calling this method on an Object with any other kind may result in undefined behavior.

Source

pub unsafe fn as_luaref_unchecked(&self) -> LuaRef

Returns the Lua reference stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be a LuaRef. Calling this method on an Object with any other kind may result in undefined behavior.

Source

pub unsafe fn as_luaref_unchecked_mut(&mut self) -> &mut LuaRef

Returns a mutable reference to the Lua reference stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be a LuaRef. Calling this method on an Object with any other kind may result in undefined behavior.

Source

pub unsafe fn as_nvim_str_unchecked(&self) -> NvimStr<'_>

Returns a reference to the string stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be a String. Calling this method on an Object with any other kind may result in undefined behavior.

Source

pub unsafe fn into_string_unchecked(self) -> NvimString

Returns the string stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be a String. Calling this method on an Object with any other kind may result in undefined behavior.

Source

pub unsafe fn as_array_unchecked(&self) -> &Array

Returns a reference to the array stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be an Array. Calling this method on an Object with any other kind may result in undefined behavior.

Source

pub unsafe fn as_array_unchecked_mut(&mut self) -> &mut Array

Returns a mutable reference to the array stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be an Array. Calling this method on an Object with any other kind may result in undefined behavior.

Source

pub unsafe fn into_array_unchecked(self) -> Array

Returns the array stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be an Array. Calling this method on an Object with any other kind may result in undefined behavior.

Source

pub unsafe fn as_dictionary_unchecked(&self) -> &Dictionary

Returns a reference to the dictionary stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be a Dictionary. Calling this method on an Object with any other kind may result in undefined behavior.

Source

pub unsafe fn as_dictionary_unchecked_mut(&mut self) -> &mut Dictionary

Returns a mutable reference to the dictionary stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be a Dictionary. Calling this method on an Object with any other kind may result in undefined behavior.

Source

pub unsafe fn into_dictionary_unchecked(self) -> Dictionary

Returns the dictionary stored in this Object.

This is a zero-cost method that directly accesses the underlying value without performing any runtime checks.

§Safety

This Object’s ObjectKind must be a Dictionary. Calling this method on an Object with any other kind may result in undefined behavior.

Trait Implementations§

Source§

impl Clone for Object

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Object

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Object

Source§

fn default() -> Object

Returns the “default value” for a type. Read more
Source§

impl Drop for Object

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<&str> for Object

Source§

fn from(s: &str) -> Self

Converts to this type from the input type.
Source§

impl From<()> for Object

Source§

fn from(_: ()) -> Self

Converts to this type from the input type.
Source§

impl From<Array> for Object

Source§

fn from(array: Array) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Box<T>> for Object
where Object: From<T>,

Source§

fn from(boxed: Box<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Cow<'_, T>> for Object
where T: Clone, Object: From<T>,

Source§

fn from(moo: Cow<'_, T>) -> Self

Converts to this type from the input type.
Source§

impl From<Cow<'_, str>> for Object

Source§

fn from(moo: Cow<'_, str>) -> Self

Converts to this type from the input type.
Source§

impl From<Dictionary> for Object

Source§

fn from(dictionary: Dictionary) -> Self

Converts to this type from the input type.
Source§

impl<A, R> From<Function<A, R>> for Object

Source§

fn from(fun: Function<A, R>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Option<T>> for Object
where Object: From<T>,

Source§

fn from(maybe: Option<T>) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Object

Source§

fn from(string: NvimString) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Object

Source§

fn from(s: String) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for Object

Source§

fn from(boolean: Boolean) -> Self

Converts to this type from the input type.
Source§

impl From<char> for Object

Source§

fn from(ch: char) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for Object

Source§

fn from(n: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Object

Source§

fn from(float: Float) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Object

Source§

fn from(i: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Object

Source§

fn from(i: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Object

Source§

fn from(integer: Integer) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Object

Source§

fn from(i: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Object

Source§

fn from(i: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Object

Source§

fn from(i: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Object

Source§

fn from(i: u8) -> Self

Converts to this type from the input type.
Source§

impl<K, V> FromIterator<(K, V)> for Object
where String: From<K>, Object: From<V>,

Source§

fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T> FromIterator<T> for Object
where T: Into<Object>,

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromObject for Object

Source§

impl PartialEq for Object

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Poppable for Object

Source§

unsafe fn pop(lstate: *mut State) -> Result<Self, Error>

Pops the value at the top of the stack.
Source§

impl Pushable for Object

Source§

unsafe fn push(self, lstate: *mut State) -> Result<c_int, Error>

Pushes all its values on the Lua stack, returning the number of values that it pushed.
Source§

impl TryFrom<Object> for Dictionary

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(obj: Object) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Object> for String

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(obj: Object) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Object> for i16

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(obj: Object) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Object> for i32

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(obj: Object) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Object> for i8

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(obj: Object) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Object> for isize

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(obj: Object) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Object> for u128

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(obj: Object) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Object> for u16

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(obj: Object) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Object> for u32

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(obj: Object) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Object> for u64

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(obj: Object) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Object> for u8

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(obj: Object) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Object> for usize

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(obj: Object) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for Object

§

impl RefUnwindSafe for Object

§

impl !Send for Object

§

impl !Sync for Object

§

impl Unpin for Object

§

impl UnwindSafe for Object

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoResult<T> for T

Source§

type Error = Infallible

The error type in the returned Result.
Source§

fn into_result(self) -> Result<T, <T as IntoResult<T>>::Error>

Converts the value into a Result.
Source§

impl<T> ToObject for T
where T: Into<Object>,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.