pub struct WSLContext {
pub api: &'static ApiV1,
}Expand description
A global context for the WSL plugin API.
The WSLContext contains the API interface (ApiV1) and ensures safe, global access
throughout the plugin’s lifecycle.
Fields§
§api: &'static ApiV1The API interface used for interacting with the WSL plugin API.
Implementations§
Source§impl WSLContext
impl WSLContext
Sourcepub fn get_current() -> Option<&'static Self>
pub fn get_current() -> Option<&'static Self>
Retrieves the current WSLContext instance, if it has been initialized.
§Returns
Some(&'static WSLContext): If the context has been initialized.None: If the context has not yet been initialized.
§Example
use wslplugins_rs::WSLContext;
if let Some(context) = WSLContext::get_current() {
// Use the context
} else {
eprintln!("WSL context is not initialized.");
}Sourcepub fn get_current_or_panic() -> &'static Self
pub fn get_current_or_panic() -> &'static Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WSLContext
impl RefUnwindSafe for WSLContext
impl Send for WSLContext
impl Sync for WSLContext
impl Unpin for WSLContext
impl UnsafeUnpin for WSLContext
impl UnwindSafe for WSLContext
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