pub struct InitCx {
pub app_dir: PathBuf,
pub app_id: String,
pub headless: bool,
pub hot_reload: bool,
pub lumen_version: String,
/* private fields */
}Expand description
What a plugin knows about the app it was loaded into.
Fields§
§app_dir: PathBufThe app directory, canonicalized. A plugin resolves its own files against this rather than against the process’s working directory.
app_id: StringThe app’s id from lumen.toml, or its directory name when it
declares none.
headless: boolTrue when the app runs without a window.
hot_reload: boolTrue when the app was started with hot reload on, so a plugin that caches derived state knows the sources under it can change.
lumen_version: StringThe engine’s version, as a semver string.
Implementations§
Source§impl InitCx
impl InitCx
Sourcepub fn new(
app_dir: PathBuf,
app_id: String,
headless: bool,
hot_reload: bool,
lumen_version: String,
config_toml: String,
) -> Self
pub fn new( app_dir: PathBuf, app_id: String, headless: bool, hot_reload: bool, lumen_version: String, config_toml: String, ) -> Self
Build a context. Host-side; a plugin only ever reads one.
Sourcepub fn config<T: DeserializeOwned>(&self) -> Result<T, Error>
pub fn config<T: DeserializeOwned>(&self) -> Result<T, Error>
Deserialize the module’s config table into any serde type. An app
that declares no table yields the type’s view of an empty table.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for InitCx
impl<'de> Deserialize<'de> for InitCx
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for InitCx
impl RefUnwindSafe for InitCx
impl Send for InitCx
impl Sync for InitCx
impl Unpin for InitCx
impl UnsafeUnpin for InitCx
impl UnwindSafe for InitCx
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.