Struct rb_sys_build::RbConfig

source ·
pub struct RbConfig {
    pub search_paths: Vec<SearchPath>,
    pub libs: Vec<Library>,
    pub link_args: Vec<String>,
    pub cflags: Vec<String>,
    pub blocklist_lib: Vec<String>,
    pub blocklist_link_arg: Vec<String>,
    /* private fields */
}
Expand description

Extracts structured information from raw compiler/linker flags to make compiling Ruby gems easier.

Fields§

§search_paths: Vec<SearchPath>§libs: Vec<Library>§link_args: Vec<String>§cflags: Vec<String>§blocklist_lib: Vec<String>§blocklist_link_arg: Vec<String>

Implementations§

source§

impl RbConfig

source

pub fn all_keys(&self) -> Keys<'_, String, String>

All keys in the RbConfig’s value map.

source

pub fn current() -> RbConfig

Instantiates a new RbConfig for the current Ruby.

Pushes the LIBRUBYARG flags so Ruby will be linked.

source

pub fn libruby_static_name(&self) -> String

Get the name for libruby-static (i.e. ruby.3.1-static).

source

pub fn libruby_so_name(&self) -> String

Get the name for libruby (i.e. ruby.3.1)

source

pub fn platform(&self) -> String

Get the platform for the current ruby.

source

pub fn blocklist_lib(&mut self, name: &str) -> &mut RbConfig

Filter the libs, removing the ones that are not needed.

Blocklist a link argument.

source

pub fn ruby_program_version(&self) -> String

Returns the current ruby program version.

source

pub fn cppflags(&self) -> Vec<String>

Get the CPPFLAGS from the RbConfig, making sure to subsitute variables.

source

pub fn get(&self, key: &str) -> String

Returns the value of the given key from the either the matching RBCONFIG_{key} environment variable or RbConfig::CONFIG[{key}] hash.

source

pub fn is_cross_compiling(&self) -> bool

Returns true if the current Ruby is cross compiling.

source

pub fn get_optional(&self, key: &str) -> Option<String>

Returns the value of the given key from the either the matching RBCONFIG_{key} environment variable or RbConfig::CONFIG[{key}] hash.

source

pub fn use_rpath(&mut self) -> &mut RbConfig

Enables the use of rpath for linking.

source

pub fn push_cflags(&mut self, cflags: &str) -> &mut Self

Push cflags string

source

pub fn major_minor(&self) -> (u32, u32)

Get major/minor version tuple of Ruby

source

pub fn cargo_args(&self) -> Vec<String>

Get the rb_config output for cargo

source

pub fn print_cargo_args(&self)

Print to rb_config output for cargo

source

pub fn push_dldflags(&mut self, input: &str) -> &mut Self

Adds items to the rb_config based on a string from LDFLAGS/DLDFLAGS

source

pub fn set_value_for_key(&mut self, key: &str, value: String)

Sets a value for a key

source

pub fn has_ruby_dln_check_abi(&self) -> bool

source

pub fn have_ruby_header<T: AsRef<str>>(&self, header: T) -> bool

Trait Implementations§

source§

impl Debug for RbConfig

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for RbConfig

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl PartialEq for RbConfig

source§

fn eq(&self, other: &RbConfig) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for RbConfig

source§

impl StructuralPartialEq for RbConfig

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

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

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

§

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>,

§

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.