Skip to main content

NixLibHelper

Struct NixLibHelper 

Source
pub struct NixLibHelper;
Expand description

Helpers for emitting lib.* function calls.

Implementations§

Source§

impl NixLibHelper

Source

pub fn mk_option( ty: NixExpr, default: Option<NixExpr>, description: Option<&str>, ) -> NixExpr

Generate lib.mkOption { type; default; description; }.

Source

pub fn mk_if(cond: NixExpr, value: NixExpr) -> NixExpr

Generate lib.mkIf cond value.

Source

pub fn mk_default(value: NixExpr) -> NixExpr

Generate lib.mkDefault value.

Source

pub fn mk_force(value: NixExpr) -> NixExpr

Generate lib.mkForce value.

Source

pub fn mk_merge(items: Vec<NixExpr>) -> NixExpr

Generate lib.mkMerge [ ... ].

Source

pub fn type_str() -> NixExpr

Generate lib.types.str.

Source

pub fn type_int() -> NixExpr

Generate lib.types.int.

Source

pub fn type_bool() -> NixExpr

Generate lib.types.bool.

Source

pub fn type_list_of(ty: NixExpr) -> NixExpr

Generate lib.types.listOf T.

Source

pub fn type_attrs_of(ty: NixExpr) -> NixExpr

Generate lib.types.attrsOf T.

Source

pub fn concat_map_strings(f: NixExpr, list: NixExpr) -> NixExpr

Generate lib.concatMapStrings f list.

Source

pub fn concat_strings_sep(sep: &str, list: NixExpr) -> NixExpr

Generate lib.concatStringsSep sep list.

Source

pub fn map_attrs_to_list(f: NixExpr, attrs: NixExpr) -> NixExpr

Generate lib.mapAttrsToList f attrs.

Source

pub fn attr_by_path( path: Vec<&str>, default: NixExpr, attrs: NixExpr, ) -> NixExpr

Generate lib.attrByPath ["a" "b"] default attrs.

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.