StaticIter

Struct StaticIter 

Source
pub struct StaticIter<'a, T> {
    pub map: Box<dyn Fn(&State, T) -> Result<Pushed> + 'a>,
    /* private fields */
}
Expand description

Represents an iterator

Fields§

§map: Box<dyn Fn(&State, T) -> Result<Pushed> + 'a>

Implementations§

Source§

impl<T: ToLuaMulti + 'static> StaticIter<'static, T>

Source

pub fn new(iter: impl Iterator<Item = T> + 'static) -> Self

Trait Implementations§

Source§

impl<T: ToLuaMulti + 'static, I: Iterator<Item = T> + 'static> From<I> for StaticIter<'static, T>

Source§

fn from(iter: I) -> Self

Converts to this type from the input type.
Source§

impl<'a, T> UserData for StaticIter<'a, T>

Source§

type Trans = RefCell<StaticIter<'a, T>>

Source§

fn methods(methods: UserdataRegistry<'_, Self>) -> Result<()>

add methods
Source§

fn metatable(mt: UserdataRegistry<'_, Self>) -> Result<()>

add else meta methods, and you can acquire or overwrite the generated metamethods
Source§

const TYPE_NAME: &'static str = _

__name field in metatable
Source§

const INDEX_USERVALUE: bool = false

get/set value from the first uservalue when read/write property
Source§

const RAW_LEN: bool = false

set the __len metamethod, if true, return the size of this userdata
Source§

const WEAK_REF_CACHE: bool = true

set the cache table is a weaked reference if key_to_cache enabled
Source§

const ACCESS_ERROR: bool = true

whether raising error when accessing non-exists property
Source§

const METATABLE_KEY: MetatableKey = _

Source§

fn metatable_key() -> MetatableKey

Source§

fn getter(fields: UserdataRegistry<'_, Self>) -> Result<()>

add fields getter
Source§

fn setter(fields: UserdataRegistry<'_, Self>) -> Result<()>

add fields setter
Source§

fn init_userdata( this: &Self::Trans, s: &State, udata: &LuaUserData<'_>, ) -> Result<()>

initialize userdata on the top of lua stack
Source§

fn key_to_cache(&self) -> *const ()

get a pointer whose type is lightuserdata as the key in cache table
Source§

fn uservalue_count(&self, s: &State) -> i32

Source§

unsafe extern "C-unwind" fn __index(l: *mut lua_State) -> c_int

Source§

unsafe extern "C-unwind" fn __newindex(l: *mut lua_State) -> c_int

Source§

unsafe extern "C-unwind" fn __close(l: *mut lua_State) -> c_int

Auto Trait Implementations§

§

impl<'a, T> Freeze for StaticIter<'a, T>

§

impl<'a, T> !RefUnwindSafe for StaticIter<'a, T>

§

impl<'a, T> !Send for StaticIter<'a, T>

§

impl<'a, T> !Sync for StaticIter<'a, T>

§

impl<'a, T> Unpin for StaticIter<'a, T>

§

impl<'a, T> !UnwindSafe for StaticIter<'a, T>

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> 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> ToLua for T
where T: UserData,

Source§

const __PUSH: Option<fn(T, &State) -> Result<(), Error>> = const __PUSH: Option<for fn(Self, &'_ State) -> Result<()>> = Some(|this, s| s.push_udatauv(this, 0));

Source§

fn to_lua<'a>(self, lua: &'a State) -> Result<ValRef<'a>>

Source§

impl<T> ToLuaMulti for T
where T: ToLua,

Source§

const VALUE_COUNT: Option<usize> = const VALUE_COUNT: Option<usize> = Some(1);

Count of values to be pushed to lua stack
Source§

fn push_multi(self, s: &State) -> Result<usize, Error>

Define how to push values onto lua stack
Source§

fn value_count(&self) -> Option<usize>

Get the count of values to be pushed to lua stack, with self instance
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> UserDataTrans<T> for T
where T: UserData,

Source§

const FROM_INNER: fn(T) -> T = const FROM_INNER: fn(T) -> Self = core::convert::identity;

Source§

const INTO_INNER: fn(T) -> T = const INTO_INNER: fn(Self) -> T = core::convert::identity;

Source§

type Read<'a> = &'a T where T: 'a

Source§

type Write<'a> = &'a mut T where T: 'a

Source§

fn read(&self) -> <T as UserDataTrans<T>>::Read<'_>

Source§

const INIT_USERDATA: Option<fn(&State, &mut Self)> = None