Feature in cargo::core::features - Rust
Description: Status and metadata for a single unstable feature.

Skip to main content

## Feature

# Struct Feature

Source

    pub struct Feature {
        name: &'static str,
        stability: Status,
        version: &'static str,
        docs: &'static str,
        get: fn(&Features) -> bool,
    }

Expand description

Status and metadata for a single unstable feature.

## Fields§

§`name: &'static str`

Feature name. This is valid Rust identifier so no dash only underscore.

§`stability: Status`§`version: &'static str`

Version that this feature was stabilized or removed.

§`docs: &'static str`

Link to the unstable documentation.

§`get: fn(&Features) -> bool`

## Implementations§

Source§

### impl Feature

Source

#### pub const fn test_dummy_stable() -> &'static Feature

A dummy feature that doesn’t actually gate anything, but it’s used in testing to ensure that we can enable stable features.

See https://doc.rust-lang.org/nightly/cargo/.

Source

#### pub const fn test_dummy_unstable() -> &'static Feature

A dummy feature that gates the usage of the `im-a-teapot` manifest entry. This is basically just intended for tests.

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html.

Source

#### pub const fn alternative_registries() -> &'static Feature

Downloading packages from alternative registry indexes.

See https://doc.rust-lang.org/nightly/cargo/reference/registries.html.

Source

#### pub const fn edition() -> &'static Feature

Using editions

See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field.

Source

#### pub const fn rename_dependency() -> &'static Feature

Renaming a package in the manifest via the `package` key.

See https://doc.rust-lang.org/nightly/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml.

Source

#### pub const fn publish_lockfile() -> &'static Feature

Whether a lock file is published with this crate.

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#publish-lockfile.

Source

#### pub const fn profile_overrides() -> &'static Feature

Overriding profiles for dependencies.

See https://doc.rust-lang.org/nightly/cargo/reference/profiles.html#overrides.

Source

#### pub const fn default_run() -> &'static Feature

“default-run” manifest option.

See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-default-run-field.

Source

#### pub const fn metabuild() -> &'static Feature

Declarative build scripts.

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#metabuild.

Source

#### pub const fn public_dependency() -> &'static Feature

Specifying the ‘public’ attribute on dependencies.

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#public-dependency.

Source

#### pub const fn named_profiles() -> &'static Feature

Allow to specify profiles other than ‘dev’, ‘release’, ‘test’, etc.

See https://doc.rust-lang.org/nightly/cargo/reference/profiles.html#custom-profiles.

Source

#### pub const fn resolver() -> &'static Feature

Opt-in new-resolver behavior.

See https://doc.rust-lang.org/nightly/cargo/reference/resolver.html#resolver-versions.

Source

#### pub const fn strip() -> &'static Feature

Allow to specify whether binaries should be stripped.

See https://doc.rust-lang.org/nightly/cargo/reference/profiles.html#strip-option.

Source

#### pub const fn rust_version() -> &'static Feature

Specifying a minimal ‘rust-version’ attribute for crates.

See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-rust-version-field.

Source

#### pub const fn edition2021() -> &'static Feature

Support for 2021 edition.

See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field.

Source

#### pub const fn per_package_target() -> &'static Feature

Allow to specify per-package targets (compile kinds).

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#per-package-target.

Source

#### pub const fn codegen_backend() -> &'static Feature

Allow to specify which codegen backend should be used.

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#codegen-backend.

Source

#### pub const fn different_binary_name() -> &'static Feature

Allow specifying different binary name apart from the crate name.

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#different-binary-name.

Source

#### pub const fn profile_rustflags() -> &'static Feature

Allow specifying rustflags directly in a profile.

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#profile-rustflags-option.

Source

#### pub const fn workspace_inheritance() -> &'static Feature

Allow workspace members to inherit fields and dependencies from a workspace.

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#workspace-inheritance.

Source

#### pub const fn edition2024() -> &'static Feature

Support for 2024 edition.

See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field.

Source

#### pub const fn trim_paths() -> &'static Feature

Allow setting trim-paths in a profile to control the sanitisation of file paths in build outputs.

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#profile-trim-paths-option.

Source

#### pub const fn open_namespaces() -> &'static Feature

Allow multiple packages to participate in the same API namespace

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#open-namespaces.

Source

#### pub const fn path_bases() -> &'static Feature

Allow paths that resolve relatively to a base specified in the config.

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#path-bases.

Source

#### pub const fn unstable_editions() -> &'static Feature

Allows use of editions that are not yet stable.

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#unstable-editions.

Source

#### pub const fn multiple_build_scripts() -> &'static Feature

Allows use of multiple build scripts.

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#multiple-build-scripts.

Source

#### pub const fn panic_immediate_abort() -> &'static Feature

Allows use of panic=“immediate-abort”.

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#panic-immediate-abort.

Source

#### fn is_enabled(&self, features: &Features) -> bool

Whether this feature is allowed to use in the given `Features` context.

Source

#### pub(crate) fn name(&self) -> &str

## Trait Implementations§

Source§

### impl Debug for Feature

Source§

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

Formats the value using the given formatter. Read more

## Auto Trait Implementations§

§

### impl Freeze for Feature

§

### impl RefUnwindSafe for Feature

§

### impl Send for Feature

§

### impl Sync for Feature

§

### impl Unpin for Feature

§

### impl UnsafeUnpin for Feature

§

### impl UnwindSafe for Feature

## 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.

§

### impl<T> Instrument for T

§

#### fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [`Span`], returning an `Instrumented` wrapper. Read more
§

#### fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more
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
§

### impl<T> Pointable for T

§

#### const ALIGN: usize

The alignment of pointer.
§

#### type Init = T

The type for initializers.
§

#### unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

#### unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

#### unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

#### unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = 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.
§

### impl<T> WithSubscriber for T

§

#### fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more
§

#### fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more

## Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain `repr(...)` attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 64 bytes