Struct LuaProtoc

Source
pub struct LuaProtoc {
    pub codec: LuaProtoCodec,
    pub file_descriptors: HashMap<String, LuaFileDescriptor>,
    pub message_descriptors: HashMap<String, LuaMessageDescriptor>,
    pub enum_descriptors: HashMap<String, LuaEnumDescriptor>,
}

Fields§

§codec: LuaProtoCodec§file_descriptors: HashMap<String, LuaFileDescriptor>§message_descriptors: HashMap<String, LuaMessageDescriptor>§enum_descriptors: HashMap<String, LuaEnumDescriptor>

Implementations§

Source§

impl LuaProtoc

Source

pub fn new(descriptors: Vec<FileDescriptor>) -> Self

Source

pub fn parse_files( inputs: impl IntoIterator<Item = impl AsRef<Path>>, includes: impl IntoIterator<Item = impl AsRef<Path>>, ) -> Result<Self>

Source

pub fn parse_proto(proto: impl AsRef<str>) -> Result<Self>

Source

pub fn parse_pb(path: impl AsRef<Path>) -> Result<Self>

Source

pub fn gen_pb(&self, path: String) -> Result<()>

Source

pub fn gen_lua(&self, path: String) -> Result<()>

Source

pub fn encode( &self, message_full_name: &str, lua_message: &Table, ) -> Result<Box<dyn MessageDyn>>

Source

pub fn decode( &self, lua: &Lua, message_full_name: String, message_bytes: &[u8], ) -> Result<Table>

Source

pub fn list_protos( paths: impl IntoIterator<Item = impl AsRef<Path>>, ) -> Vec<PathBuf>

Trait Implementations§

Source§

impl Default for LuaProtoc

Source§

fn default() -> LuaProtoc

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

impl UserData for LuaProtoc

Source§

fn add_methods<M: UserDataMethods<Self>>(methods: &mut M)

Adds custom methods and operators specific to this userdata.
Source§

fn add_fields<F>(fields: &mut F)
where F: UserDataFields<Self>,

Adds custom fields specific to this userdata.
Source§

fn register(registry: &mut UserDataRegistry<Self>)

Registers this type for use in Lua. Read more

Auto Trait Implementations§

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> 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> IntoLua for T
where T: UserData + MaybeSend + 'static,

Source§

fn into_lua(self, lua: &Lua) -> Result<Value, Error>

Performs the conversion.
Source§

impl<T> IntoLuaMulti for T
where T: IntoLua,

Source§

fn into_lua_multi(self, lua: &Lua) -> Result<MultiValue, Error>

Performs the conversion.
Source§

unsafe fn push_into_stack_multi(self, lua: &RawLua) -> Result<i32, Error>

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> MaybeSend for T