Skip to main content

Crate wslplugins_rs

Crate wslplugins_rs 

Source
Expand description

§WSLPlugin-rs

This is the main entry point for the WSLPlugin-rs crate, a framework designed for creating plugins for the Windows Subsystem for Linux (WSL) using idiomatic Rust.

§Overview

WSLPlugin-rs simplifies the development of WSL plugins by providing higher-level abstractions built on top of the raw APIs. This crate exports useful modules and types for plugin creation, such as session management, VM handling, and distribution operations.

§Usage

Use the exposed modules and types to build custom WSL plugins. Conditional features like macro enable procedural macros for simplifying the plugin development process.

§Example

#[cfg(feature = "macro")]
use wslplugins_rs::prelude::*;
pub(crate) struct MyPlugin {
  context: &'static WSLContext,
}
#[wsl_plugin_v1(2, 0, 5)]
impl WSLPluginV1 for MyPlugin {
    fn try_new(context: &'static WSLContext) -> WinResult<Self> {
        Ok(MyPlugin { context })
    }
}

Re-exports§

pub use wsl_user_configuration::WSLUserConfiguration;
pub use distribution_id::DistributionID;
pub use api::WSLCommandExecution;
pub use user_distribution_id::UserDistributionID;
pub use windows_core;
pub use typed_path;
pub use wslpluginapi_sys as sys;sys

Modules§

api
Provides interfaces for interacting with WSL plugin APIs.
distribution_id
Module DistributionID
plugin
Tools and utilities for creating custom WSL plugins.
prelude
Convenient re-exports for common plugin development imports. Common imports for building WSL plugins with this crate.
user_distribution_id
wsl_user_configuration
Provides types and utilities to interact with WSL (Windows Subsystem for Linux) user configurations.

Structs§

DistributionInformation
Represents detailed information about a WSL distribution.
OfflineDistributionInformation
A wrapper around WslOfflineDistributionInformation providing a safe interface.
SessionID
WSLContext
A global context for the WSL plugin API.
WSLSessionInformation
Represents session information for a WSL instance.
WSLVersion
Represents a WSL version number.
WSLVmCreationSettings
Represents WSL VM creation settings.

Traits§

CoreDistributionInformation
A trait representing the core information of a WSL distribution.

Attribute Macros§

wsl_plugin_v1macro
Re-exports procedural macros when the macro feature is enabled. It allow to mark a plugin struct (that implement WSLPluginV1 trait) to be easely integrated to the WSL plugin system without writing manually C code for entry point or hooks. Attribute macro for WSL plugin V1. This macro should be used on impl block of WSLPluginV1 in order to register the plugin that implement this interface