Skip to main content

ContextBuilder

Struct ContextBuilder 

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

A builder to configure a Context.

§Examples

Create a Context using the defaults.

use sequoia_cryptoki::ContextBuilder;

let context = ContextBuilder::new().build()?;

Implementations§

Source§

impl ContextBuilder

Source

pub fn new() -> Self

Returns a new, default context builder.

Source

pub fn home<H>(&mut self, home: H) -> &mut Self
where H: Into<Option<Home>>,

Use an alternate sequoia home directory.

If None, uses the default.

Source

pub fn config_file<P>(&mut self, path: P) -> &mut Self
where P: Into<PathBuf>,

Load an alternate configuration file.

By default, the configuration file in the Sequoia home directory is read. When set, the specified file is read instead.

Source

pub fn disable_config_file(&mut self) -> &mut Self

Don’t load a configuration file.

By default, the configuration file in the Sequoia home directory is read. When reading the configuration file is disabled, the default configuration is used.

Source

pub fn add_module<P>(&mut self, path: P) -> &mut Self
where P: Into<PathBuf>,

Adds the specified module to the set of PKCS#11 modules to load.

Source

pub fn extend_modules<P>(&mut self, paths: impl Iterator<Item = P>) -> &mut Self
where P: Into<PathBuf>,

Adds the specified modules to the set of PKCS#11 modules to load.

Source

pub fn build(&self) -> Result<Context>

Returns a new Context based on the builder.

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

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.