Skip to main content

Provider

Struct Provider 

Source
pub struct Provider {
    pub release: Version,
    pub sysroot: PathBuf,
    pub stubs: PathBuf,
    pub gcc_startup: PathBuf,
    pub compiler_runtime: PathBuf,
    pub descriptor: String,
}
Expand description

A parsed provider descriptor. Its paths are absolute and have no .. components; Provider::validate_files checks what they contain.

Fields§

§release: Version

The glibc release (glibc field), one of RELEASES.

§sysroot: PathBuf

The release’s headers, startup objects, nonshared archives and loader (sysroot field).

§stubs: PathBuf

The link stubs of SONAMES and their linker names (stubs field).

§gcc_startup: PathBuf

The GCC directory with crtbegin.o and crtend.o (gcc-startup field).

§compiler_runtime: PathBuf

The libgcc_s stub, libgcc_s.so and libgcc_s.so.1 (compiler-runtime field).

§descriptor: String

The descriptor text exactly as read.

Implementations§

Source§

impl Provider

Source

pub fn load(path: &Path) -> Result<Self, String>

Reads and parses the descriptor at PATH (see Provider::parse).

§Errors

When the file cannot be read, or Provider::parse rejects it.

Source

pub fn parse(text: &str) -> Result<Self, String>

Parses a version-1 descriptor: the FORMAT line, then exactly the six tab-separated fields target, glibc, sysroot, stubs, gcc-startup and compiler-runtime, in any order. It checks only the text; see Provider::validate_files for the files.

§Errors

When the text is over 16 KiB, has CR characters or no final newline, has another format line, has an unknown, duplicate, empty or control-character field, lacks a field, names a target other than x86_64-unknown-linux-gnu or a glibc outside RELEASES, or has a path that is relative or contains ...

Source

pub fn nonshared_archives(&self) -> &'static [&'static str]

Static archives linked into every executable, relative to the sysroot. glibc 2.28 merged libpthread_nonshared.a into libc_nonshared.a.

Source

pub fn validate_selection(&self, requested: Version) -> Result<(), String>

Checks that the provider is for exactly the REQUESTED glibc release.

§Errors

When REQUESTED differs from Provider::release; there is no fallback to another release.

Source

pub fn validate_files(&self) -> Result<(), String>

Checks the provider’s files: each directory exists; the headers (features.h), startup objects, loader and nonshared archives are in the sysroot; crtbegin.o and crtend.o are in Provider::gcc_startup; the libgcc_s stub is in Provider::compiler_runtime; and every stub and linker name is in Provider::stubs. Each must resolve, after following symbolic links, to a regular file inside its directory, and each linker name to the same file as its soname. It does not check file contents.

§Errors

When a directory or file is missing, resolves outside its directory, or a linker name resolves to another file than its soname.

Trait Implementations§

Source§

impl Clone for Provider

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Provider

Source§

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

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.