# Struct cargo::core::features::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/unstable.html#edition-2024.

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

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

§

#### type Output = T

Should always be `Self`
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.
§

### impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

#### fn vzip(self) -> V

§

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