pub trait ToResourceId {
// Required method
fn to_resource_id(self, resource_type: ResourceType) -> ResourceId;
}
Expand description
A trait for creating a ResourceId
from another type.
This differs from the From
trait in that the From
trait
always takes the default resource type of ResourceType::Required
.
If you need to create a resource with a non-default ResourceType
,
such as ResourceType::Optional
, then use this trait.
This trait is automatically implemented for types that implement Into<String>
.
Required Methods§
Sourcefn to_resource_id(self, resource_type: ResourceType) -> ResourceId
fn to_resource_id(self, resource_type: ResourceType) -> ResourceId
Creates a ResourceId
from self
, given a ResourceType
.