Builder

Struct Builder 

Source
pub struct Builder { /* private fields */ }
Expand description

A builder for wl-client wrappers.

Implementations§

Source§

impl Builder

Source

pub fn wl_client_path(self, path: &str) -> Self

Sets the rust module path to the wl-client crate.

By default, the generated code assumes that the wl-client crate is accessible via ::wl_client.

Source

pub fn xml_file(self, path: impl AsRef<Path>) -> Self

Adds a protocol XML file.

Source

pub fn xml_dir(self, path: impl AsRef<Path>) -> Self

Adds a protocol XML dir.

This behaves as if all XML files in this directory (but not in any sub-directories) had been added with Builder::xml_file.

Source

pub fn with_default_dir(self, default_dir: bool) -> Self

Enables or disables the default wayland-protocols dir.

By default, the builder will try to load XML files from the wayland-protocols directory relative to the current working directory.

Source

pub fn for_build_rs(self, build_rs: bool) -> Self

Enables or disables build.rs logic.

By default, the builder assumes that it is being used from build.rs. It will emit cargo:: messages and treats a relative Builder::target_dir as relative to $OUT_DIR.

Source

pub fn target_dir(self, target_dir: impl AsRef<Path>) -> Self

The target directory into which to generate the mod.rs.

By default, the target directory is wayland-protocols.

If Builder::for_build_rs is enabled, then a relative target directory will be interpreted relative to $OUT_DIR.

Source

pub fn with_mutable_data(self, mutable_data: bool) -> Self

Enables or disables mutable data parameters.

This is disabled by default. If it is enabled, event handlers take an additional parameter that gives access to mutable data that was passed in when dispatching a queue.

Source

pub fn build(self) -> Result<(), Error>

Generates the code.

Trait Implementations§

Source§

impl Default for Builder

Source§

fn default() -> Self

Returns the “default value” for a type. 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, 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.