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() -> Object

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: i32) -> Object

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) -> i64

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 i64

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) -> f64

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 f64

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) -> i32

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 i32

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) -> String

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) -> Object

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<(), Error>

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<'de> Deserialize<'de> for Object

Source§

fn deserialize<D>( deserializer: D, ) -> Result<Object, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Drop for Object

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<&Buffer> for Object

Source§

fn from(buf: &Buffer) -> Object

Converts to this type from the input type.
Source§

impl From<&Window> for Object

Source§

fn from(win: &Window) -> Object

Converts to this type from the input type.
Source§

impl From<&WindowRelativeTo> for Object

Source§

fn from(pos: &WindowRelativeTo) -> Object

Converts to this type from the input type.
Source§

impl From<&WindowTitle> for Object

Source§

fn from(title: &WindowTitle) -> Object

Converts to this type from the input type.
Source§

impl From<&WindowTitlePosition> for Object

Source§

fn from(pos: &WindowTitlePosition) -> Object

Converts to this type from the input type.
Source§

impl From<&str> for Object

Source§

fn from(s: &str) -> Object

Converts to this type from the input type.
Source§

impl From<()> for Object

Source§

fn from(_: ()) -> Object

Converts to this type from the input type.
Source§

impl From<Array> for Object

Source§

fn from(array: Array) -> Object

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>) -> Object

Converts to this type from the input type.
Source§

impl From<Buffer> for Object

Source§

fn from(buf: Buffer) -> Object

Converts to this type from the input type.
Source§

impl From<CmdMagic> for Object

Source§

fn from(magic: CmdMagic) -> Object

Converts to this type from the input type.
Source§

impl From<CmdRange> for Object

Source§

fn from(rng: CmdRange) -> Object

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>) -> Object

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl From<Dictionary> for Object

Source§

fn from(dictionary: Dictionary) -> Object

Converts to this type from the input type.
Source§

impl From<ExtmarkPosition> for Object

Source§

fn from(pos: ExtmarkPosition) -> Object

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>) -> Object

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>) -> Object

Converts to this type from the input type.
Source§

impl From<String> for Object

Source§

fn from(string: String) -> Object

Converts to this type from the input type.
Source§

impl From<String> for Object

Source§

fn from(s: String) -> Object

Converts to this type from the input type.
Source§

impl From<TabPage> for Object

Source§

fn from(tabpage: TabPage) -> Object

Converts to this type from the input type.
Source§

impl From<Window> for Object

Source§

fn from(win: Window) -> Object

Converts to this type from the input type.
Source§

impl From<WindowAnchor> for Object

Source§

fn from(anchor: WindowAnchor) -> Object

Converts to this type from the input type.
Source§

impl From<WindowBorder> for Object

Source§

fn from(border: WindowBorder) -> Object

Converts to this type from the input type.
Source§

impl From<WindowBorderChar> for Object

Source§

fn from(side: WindowBorderChar) -> Object

Converts to this type from the input type.
Source§

impl From<WindowStyle> for Object

Source§

fn from(style: WindowStyle) -> Object

Converts to this type from the input type.
Source§

impl From<bool> for Object

Source§

fn from(boolean: bool) -> Object

Converts to this type from the input type.
Source§

impl From<char> for Object

Source§

fn from(ch: char) -> Object

Converts to this type from the input type.
Source§

impl From<f32> for Object

Source§

fn from(n: f32) -> Object

Converts to this type from the input type.
Source§

impl From<f64> for Object

Source§

fn from(float: f64) -> Object

Converts to this type from the input type.
Source§

impl From<i16> for Object

Source§

fn from(i: i16) -> Object

Converts to this type from the input type.
Source§

impl From<i32> for Object

Source§

fn from(i: i32) -> Object

Converts to this type from the input type.
Source§

impl From<i64> for Object

Source§

fn from(integer: i64) -> Object

Converts to this type from the input type.
Source§

impl From<i8> for Object

Source§

fn from(i: i8) -> Object

Converts to this type from the input type.
Source§

impl From<u16> for Object

Source§

fn from(i: u16) -> Object

Converts to this type from the input type.
Source§

impl From<u32> for Object

Source§

fn from(i: u32) -> Object

Converts to this type from the input type.
Source§

impl From<u8> for Object

Source§

fn from(i: u8) -> Object

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>(iter: I) -> Object
where I: IntoIterator<Item = (K, V)>,

Creates a value from an iterator. Read more
Source§

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

Source§

fn from_iter<I>(iter: I) -> Object
where I: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
Source§

impl FromObject for Object

Source§

impl IntoDeserializer<'_, DeserializeError> for Object

Source§

type Deserializer = Deserializer

The type of the deserializer being converted into.
Source§

fn into_deserializer(self) -> Deserializer

Convert this value into a deserializer.
Source§

impl PartialEq for Object

Source§

fn eq(&self, other: &Object) -> 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<Object, Error>

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

impl Pushable for Object

Source§

unsafe fn push(self, lstate: *mut State) -> Result<i32, 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<Dictionary, <Dictionary as TryFrom<Object>>::Error>

Performs the conversion.
Source§

impl TryFrom<Object> for ModeStr

Source§

type Error = <String as TryFrom<Object>>::Error

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

fn try_from(obj: Object) -> Result<ModeStr, <ModeStr as TryFrom<Object>>::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<String, <String as TryFrom<Object>>::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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> MaybeSend for T