AnyResource

Trait AnyResource 

Source
pub trait AnyResource<const T: usize>: ResourceBase<T> {
    const NAME: &str;
    const RESOURCE_VARIETY: usize = T;
}
Expand description

Trait for expressing any version of resource: either v0::Resource or v1::Resource.

A requirement for a resource of any variety may be expressed as:

struct ContainsAResource<T: comprehensive::AnyResource<U>, const U: usize> {
    resource: std::sync::Arc<T>,
}

Required Associated Constants§

Source

const NAME: &str

The name of this resource. Used in logs and diagnostics.

Provided Associated Constants§

Source

const RESOURCE_VARIETY: usize = T

The const generic parameter of this Resource. Occasionally necessary for hinting whicg variety of Resource is being supplied to meet a T: AnyResource<U> bound.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: Resource> AnyResource<{ crate::ResourceVariety::V0 as usize }> for T

Source§

const NAME: &str = T::NAME

Source§

impl<T: Resource> AnyResource<{ crate::ResourceVariety::V1 as usize }> for T

Source§

const NAME: &str = T::NAME