Enum Oco
pub enum Oco<'a, T>{
Borrowed(&'a T),
Counted(Arc<T>),
Owned(<T as ToOwned>::Owned),
}
Expand description
“Owned Clones Once”: a smart pointer that can be either a reference, an owned value, or a reference-counted pointer. This is useful for storing immutable values, such as strings, in a way that is cheap to clone and pass around.
The cost of the Clone
implementation depends on the branch. Cloning the Oco::Borrowed
variant simply copies the references (O(1)
). Cloning the Oco::Counted
variant increments a reference count (O(1)
). Cloning the Oco::Owned
variant requires an O(n)
clone of the data.
For an amortized O(1)
clone, you can use Oco::clone_inplace()
. Using this method,
Oco::Borrowed
and Oco::Counted
are still O(1)
. Oco::Owned
does a single O(n)
clone, but converts the object to the Oco::Counted
branch, which means future clones will
be O(1)
.
In general, you’ll either want to call clone_inplace()
once, before sharing the Oco
with
other parts of your application (so that all future clones are O(1)
), or simply use this as
if it is a Cow
with an additional branch for reference-counted values.
Variants§
Borrowed(&'a T)
A static reference to a value.
Counted(Arc<T>)
A reference counted pointer to a value.
Owned(<T as ToOwned>::Owned)
An owned value.
Implementations§
§impl<T> Oco<'_, T>
impl<T> Oco<'_, T>
pub fn into_owned(self) -> <T as ToOwned>::Owned
pub fn into_owned(self) -> <T as ToOwned>::Owned
Converts the value into an owned value.
pub const fn is_borrowed(&self) -> bool
pub const fn is_borrowed(&self) -> bool
Checks if the value is Oco::Borrowed
.
§Examples
assert!(Oco::<str>::Borrowed("Hello").is_borrowed());
assert!(!Oco::<str>::Counted(Arc::from("Hello")).is_borrowed());
assert!(!Oco::<str>::Owned("Hello".to_string()).is_borrowed());
pub const fn is_counted(&self) -> bool
pub const fn is_counted(&self) -> bool
Checks if the value is Oco::Counted
.
§Examples
assert!(Oco::<str>::Counted(Arc::from("Hello")).is_counted());
assert!(!Oco::<str>::Borrowed("Hello").is_counted());
assert!(!Oco::<str>::Owned("Hello".to_string()).is_counted());
pub const fn is_owned(&self) -> bool
pub const fn is_owned(&self) -> bool
Checks if the value is Oco::Owned
.
§Examples
assert!(Oco::<str>::Owned("Hello".to_string()).is_owned());
assert!(!Oco::<str>::Borrowed("Hello").is_owned());
assert!(!Oco::<str>::Counted(Arc::from("Hello")).is_owned());
§impl<'a, T> Oco<'a, T>
impl<'a, T> Oco<'a, T>
pub fn upgrade_inplace(&mut self)
pub fn upgrade_inplace(&mut self)
Upgrades the value in place, by converting into Oco::Counted
if it
was previously Oco::Owned
.
§Examples
let mut oco1 = Oco::<str>::Owned("Hello".to_string());
assert!(oco1.is_owned());
oco1.upgrade_inplace();
assert!(oco1.is_counted());
pub fn clone_inplace(&mut self) -> Oco<'a, T>
pub fn clone_inplace(&mut self) -> Oco<'a, T>
Clones the value with inplace conversion into Oco::Counted
if it
was previously Oco::Owned
.
§Examples
let mut oco1 = Oco::<str>::Owned("Hello".to_string());
let oco2 = oco1.clone_inplace();
assert_eq!(oco1, oco2);
assert!(oco1.is_counted());
assert!(oco2.is_counted());
Trait Implementations§
§impl<'a> AddAnyAttr for Oco<'static, str>
impl<'a> AddAnyAttr for Oco<'static, str>
§type Output<SomeNewAttr: Attribute> = Oco<'static, str>
type Output<SomeNewAttr: Attribute> = Oco<'static, str>
§fn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <Oco<'static, str> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
fn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <Oco<'static, str> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
§impl AttributeValue for Oco<'static, str>
impl AttributeValue for Oco<'static, str>
§type AsyncOutput = Oco<'static, str>
type AsyncOutput = Oco<'static, str>
§type State = (Element, Oco<'static, str>)
type State = (Element, Oco<'static, str>)
§type Cloneable = Oco<'static, str>
type Cloneable = Oco<'static, str>
FnMut()
continues mutating the same
closure), but making a String
cloneable does not necessarily need to make it an
Arc<str>
, as two different clones of a String
will still have the same value.§type CloneableOwned = Oco<'static, str>
type CloneableOwned = Oco<'static, str>
'static
. This is used for spreading across types when the
spreadable attribute needs to be owned. In some cases (&'a str
to Arc<str>
, etc.) the owned
cloneable type has worse performance than the cloneable type, so they are separate.§fn to_template(_key: &str, _buf: &mut String)
fn to_template(_key: &str, _buf: &mut String)
<template>
.§fn hydrate<const FROM_SERVER: bool>(
self,
key: &str,
el: &Element,
) -> <Oco<'static, str> as AttributeValue>::State
fn hydrate<const FROM_SERVER: bool>( self, key: &str, el: &Element, ) -> <Oco<'static, str> as AttributeValue>::State
<template>
.§fn build(
self,
el: &Element,
key: &str,
) -> <Oco<'static, str> as AttributeValue>::State
fn build( self, el: &Element, key: &str, ) -> <Oco<'static, str> as AttributeValue>::State
§fn rebuild(
self,
key: &str,
state: &mut <Oco<'static, str> as AttributeValue>::State,
)
fn rebuild( self, key: &str, state: &mut <Oco<'static, str> as AttributeValue>::State, )
§fn into_cloneable(self) -> <Oco<'static, str> as AttributeValue>::Cloneable
fn into_cloneable(self) -> <Oco<'static, str> as AttributeValue>::Cloneable
§fn into_cloneable_owned(
self,
) -> <Oco<'static, str> as AttributeValue>::CloneableOwned
fn into_cloneable_owned( self, ) -> <Oco<'static, str> as AttributeValue>::CloneableOwned
'static
.§fn dry_resolve(&mut self)
fn dry_resolve(&mut self)
§impl<'a, T> Clone for Oco<'a, T>
impl<'a, T> Clone for Oco<'a, T>
§fn clone(&self) -> Oco<'a, T>
fn clone(&self) -> Oco<'a, T>
Returns a new Oco
with the same value as this one.
If the value is Oco::Owned
, this will convert it into
Oco::Counted
, so that the next clone will be O(1).
§Examples
String
:
let oco = Oco::<str>::Owned("Hello".to_string());
let oco2 = oco.clone();
assert_eq!(oco, oco2);
assert!(oco2.is_counted());
Vec
:
let oco = Oco::<[u8]>::Owned(b"Hello".to_vec());
let oco2 = oco.clone();
assert_eq!(oco, oco2);
assert!(oco2.is_counted());
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<'a, T> Deserialize<'a> for Oco<'static, T>
impl<'a, T> Deserialize<'a> for Oco<'static, T>
§fn deserialize<D>(
deserializer: D,
) -> Result<Oco<'static, T>, <D as Deserializer<'a>>::Error>where
D: Deserializer<'a>,
fn deserialize<D>(
deserializer: D,
) -> Result<Oco<'static, T>, <D as Deserializer<'a>>::Error>where
D: Deserializer<'a>,
§impl<'a> FromIterator<Oco<'a, str>> for String
impl<'a> FromIterator<Oco<'a, str>> for String
§impl IntoClass for Oco<'static, str>
impl IntoClass for Oco<'static, str>
§type AsyncOutput = Oco<'static, str>
type AsyncOutput = Oco<'static, str>
§type CloneableOwned = Oco<'static, str>
type CloneableOwned = Oco<'static, str>
'static
.§fn hydrate<const FROM_SERVER: bool>(
self,
el: &Element,
) -> <Oco<'static, str> as IntoClass>::State
fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <Oco<'static, str> as IntoClass>::State
<template>
.§fn build(self, el: &Element) -> <Oco<'static, str> as IntoClass>::State
fn build(self, el: &Element) -> <Oco<'static, str> as IntoClass>::State
§fn into_cloneable(self) -> <Oco<'static, str> as IntoClass>::Cloneable
fn into_cloneable(self) -> <Oco<'static, str> as IntoClass>::Cloneable
§fn into_cloneable_owned(
self,
) -> <Oco<'static, str> as IntoClass>::CloneableOwned
fn into_cloneable_owned( self, ) -> <Oco<'static, str> as IntoClass>::CloneableOwned
§fn dry_resolve(&mut self)
fn dry_resolve(&mut self)
§async fn resolve(self) -> <Oco<'static, str> as IntoClass>::AsyncOutput
async fn resolve(self) -> <Oco<'static, str> as IntoClass>::AsyncOutput
§fn reset(state: &mut <Oco<'static, str> as IntoClass>::State)
fn reset(state: &mut <Oco<'static, str> as IntoClass>::State)
§const MIN_LENGTH: usize = _
const MIN_LENGTH: usize = _
§fn to_template(class: &mut String)
fn to_template(class: &mut String)
<template>
.§impl IntoStyle for Oco<'static, str>
impl IntoStyle for Oco<'static, str>
§type AsyncOutput = Oco<'static, str>
type AsyncOutput = Oco<'static, str>
§type CloneableOwned = Oco<'static, str>
type CloneableOwned = Oco<'static, str>
'static
.§fn hydrate<const FROM_SERVER: bool>(
self,
el: &Element,
) -> <Oco<'static, str> as IntoStyle>::State
fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <Oco<'static, str> as IntoStyle>::State
<template>
.§fn build(self, el: &Element) -> <Oco<'static, str> as IntoStyle>::State
fn build(self, el: &Element) -> <Oco<'static, str> as IntoStyle>::State
§fn into_cloneable(self) -> <Oco<'static, str> as IntoStyle>::Cloneable
fn into_cloneable(self) -> <Oco<'static, str> as IntoStyle>::Cloneable
§fn into_cloneable_owned(
self,
) -> <Oco<'static, str> as IntoStyle>::CloneableOwned
fn into_cloneable_owned( self, ) -> <Oco<'static, str> as IntoStyle>::CloneableOwned
§fn dry_resolve(&mut self)
fn dry_resolve(&mut self)
§impl IntoStyleValue for Oco<'static, str>
impl IntoStyleValue for Oco<'static, str>
§type AsyncOutput = Oco<'static, str>
type AsyncOutput = Oco<'static, str>
§type CloneableOwned = Oco<'static, str>
type CloneableOwned = Oco<'static, str>
'static
.§fn build(
self,
style: &CssStyleDeclaration,
name: &str,
) -> <Oco<'static, str> as IntoStyleValue>::State
fn build( self, style: &CssStyleDeclaration, name: &str, ) -> <Oco<'static, str> as IntoStyleValue>::State
§fn rebuild(
self,
style: &CssStyleDeclaration,
name: &str,
state: &mut <Oco<'static, str> as IntoStyleValue>::State,
)
fn rebuild( self, style: &CssStyleDeclaration, name: &str, state: &mut <Oco<'static, str> as IntoStyleValue>::State, )
§fn hydrate(
self,
_style: &CssStyleDeclaration,
_name: &str,
) -> <Oco<'static, str> as IntoStyleValue>::State
fn hydrate( self, _style: &CssStyleDeclaration, _name: &str, ) -> <Oco<'static, str> as IntoStyleValue>::State
<template>
.§fn into_cloneable(self) -> <Oco<'static, str> as IntoStyleValue>::Cloneable
fn into_cloneable(self) -> <Oco<'static, str> as IntoStyleValue>::Cloneable
§fn into_cloneable_owned(
self,
) -> <Oco<'static, str> as IntoStyleValue>::CloneableOwned
fn into_cloneable_owned( self, ) -> <Oco<'static, str> as IntoStyleValue>::CloneableOwned
§fn dry_resolve(&mut self)
fn dry_resolve(&mut self)
§impl<T> Ord for Oco<'_, T>
impl<T> Ord for Oco<'_, T>
§impl<'b, A, B> PartialOrd<Oco<'b, B>> for Oco<'_, A>
impl<'b, A, B> PartialOrd<Oco<'b, B>> for Oco<'_, A>
§impl Render for Oco<'static, str>
impl Render for Oco<'static, str>
§impl RenderHtml for Oco<'static, str>
impl RenderHtml for Oco<'static, str>
§const MIN_LENGTH: usize = 0usize
const MIN_LENGTH: usize = 0usize
§type AsyncOutput = Oco<'static, str>
type AsyncOutput = Oco<'static, str>
§fn dry_resolve(&mut self)
fn dry_resolve(&mut self)
§async fn resolve(self) -> <Oco<'static, str> as RenderHtml>::AsyncOutput
async fn resolve(self) -> <Oco<'static, str> as RenderHtml>::AsyncOutput
§fn to_html_with_buf(
self,
buf: &mut String,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)
fn to_html_with_buf( self, buf: &mut String, position: &mut Position, escape: bool, mark_branches: bool, extra_attrs: Vec<AnyAttribute>, )
§fn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
) -> <Oco<'static, str> as Render>::State
fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <Oco<'static, str> as Render>::State
§fn into_owned(self) -> <Oco<'static, str> as RenderHtml>::Owned
fn into_owned(self) -> <Oco<'static, str> as RenderHtml>::Owned
'static
.§const EXISTS: bool = true
const EXISTS: bool = true
§fn to_html_branching(self) -> Stringwhere
Self: Sized,
fn to_html_branching(self) -> Stringwhere
Self: Sized,
§fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
§fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
§fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
§fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
§fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
§fn hydrate_async(
self,
cursor: &Cursor,
position: &PositionState,
) -> impl Future<Output = Self::State>
fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>
§fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate
, beginning at the given element.§fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate
, beginning at the given element and position.§impl<'a, T> Serialize for Oco<'a, T>
impl<'a, T> Serialize for Oco<'a, T>
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
§impl ToTemplate for Oco<'static, str>
impl ToTemplate for Oco<'static, str>
§const TEMPLATE: &'static str = <&str as ToTemplate>::TEMPLATE
const TEMPLATE: &'static str = <&str as ToTemplate>::TEMPLATE
§fn to_template(
buf: &mut String,
class: &mut String,
style: &mut String,
inner_html: &mut String,
position: &mut Position,
)
fn to_template( buf: &mut String, class: &mut String, style: &mut String, inner_html: &mut String, position: &mut Position, )
<template>
that corresponds
to a view of a particular type.impl<T> Eq for Oco<'_, T>
Auto Trait Implementations§
impl<'a, T> Freeze for Oco<'a, T>
impl<'a, T> RefUnwindSafe for Oco<'a, T>
impl<'a, T> Send for Oco<'a, T>
impl<'a, T> Sync for Oco<'a, T>
impl<'a, T> Unpin for Oco<'a, T>
impl<'a, T> UnwindSafe for Oco<'a, T>
Blanket Implementations§
§impl<T, A, P> Access<T> for P
impl<T, A, P> Access<T> for P
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
§impl<V, Key, Sig, T> BindAttribute<Key, Sig, T> for Vwhere
V: AddAnyAttr,
Key: AttributeKey,
Sig: IntoSplitSignal<Value = T>,
T: FromEventTarget + AttributeValue + PartialEq + Sync + 'static,
Signal<BoolOrT<T>>: IntoProperty,
<Sig as IntoSplitSignal>::Read: Get<Value = T> + Send + Sync + Clone + 'static,
<Sig as IntoSplitSignal>::Write: Send + Clone + 'static,
Element: GetValue<T>,
impl<V, Key, Sig, T> BindAttribute<Key, Sig, T> for Vwhere
V: AddAnyAttr,
Key: AttributeKey,
Sig: IntoSplitSignal<Value = T>,
T: FromEventTarget + AttributeValue + PartialEq + Sync + 'static,
Signal<BoolOrT<T>>: IntoProperty,
<Sig as IntoSplitSignal>::Read: Get<Value = T> + Send + Sync + Clone + 'static,
<Sig as IntoSplitSignal>::Write: Send + Clone + 'static,
Element: GetValue<T>,
§type Output = <V as AddAnyAttr>::Output<Bind<Key, T, <Sig as IntoSplitSignal>::Read, <Sig as IntoSplitSignal>::Write>>
type Output = <V as AddAnyAttr>::Output<Bind<Key, T, <Sig as IntoSplitSignal>::Read, <Sig as IntoSplitSignal>::Write>>
§fn bind(
self,
key: Key,
signal: Sig,
) -> <V as BindAttribute<Key, Sig, T>>::Output
fn bind( self, key: Key, signal: Sig, ) -> <V as BindAttribute<Key, Sig, T>>::Output
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters
when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.§impl<T> Casing<T> for T
impl<T> Casing<T> for T
§fn to_case(&self, case: Case) -> String
fn to_case(&self, case: Case) -> String
self
and create a new
String
with the same pattern and delimeter as case
. It will split on boundaries
defined at [Boundary::defaults()
]. Read more§fn with_boundaries(&self, bs: &[Boundary]) -> StateConverter<'_, T>
fn with_boundaries(&self, bs: &[Boundary]) -> StateConverter<'_, T>
StateConverter
struct initialized with the boundaries
provided. Read moreSource§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
§impl<T, K, V> CustomAttribute<K, V> for Twhere
T: AddAnyAttr,
K: CustomAttributeKey,
V: AttributeValue,
impl<T, K, V> CustomAttribute<K, V> for Twhere
T: AddAnyAttr,
K: CustomAttributeKey,
V: AttributeValue,
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<V, T, P, D> DirectiveAttribute<T, P, D> for Vwhere
V: AddAnyAttr,
D: IntoDirective<T, P>,
P: Clone + 'static,
T: 'static,
impl<V, T, P, D> DirectiveAttribute<T, P, D> for Vwhere
V: AddAnyAttr,
D: IntoDirective<T, P>,
P: Clone + 'static,
T: 'static,
§type Output = <V as AddAnyAttr>::Output<Directive<T, D, P>>
type Output = <V as AddAnyAttr>::Output<Directive<T, D, P>>
§fn directive(
self,
handler: D,
param: P,
) -> <V as DirectiveAttribute<T, P, D>>::Output
fn directive( self, handler: D, param: P, ) -> <V as DirectiveAttribute<T, P, D>>::Output
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T, A> DynAccess<T> for Awhere
A: Access<T>,
<A as Access<T>>::Guard: 'static,
impl<T, A> DynAccess<T> for Awhere
A: Access<T>,
<A as Access<T>>::Guard: 'static,
§impl<T> ElementExt for T
impl<T> ElementExt for T
§fn attr<At>(&self, attribute: At) -> <At as Attribute>::Statewhere
At: Attribute,
fn attr<At>(&self, attribute: At) -> <At as Attribute>::Statewhere
At: Attribute,
§fn class<C>(&self, class: C) -> <C as IntoClass>::Statewhere
C: IntoClass,
fn class<C>(&self, class: C) -> <C as IntoClass>::Statewhere
C: IntoClass,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle
.§impl<T> FromFormData for Twhere
T: DeserializeOwned,
impl<T> FromFormData for Twhere
T: DeserializeOwned,
§fn from_event(ev: &Event) -> Result<T, FromFormDataError>
fn from_event(ev: &Event) -> Result<T, FromFormDataError>
submit
event.§fn from_form_data(form_data: &FormData) -> Result<T, Error>
fn from_form_data(form_data: &FormData) -> Result<T, Error>
Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other
into Self
, while performing the appropriate scaling,
rounding and clamping.§impl<T> HasLen for T
impl<T> HasLen for T
Source§impl<T> Hexable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
impl<T> Hexable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T
.§impl<T> IntoAny for Twhere
T: Send + RenderHtml,
impl<T> IntoAny for Twhere
T: Send + RenderHtml,
§impl<T> IntoAttributeValue for Twhere
T: AttributeValue,
impl<T> IntoAttributeValue for Twhere
T: AttributeValue,
§fn into_attribute_value(self) -> <T as IntoAttributeValue>::Output
fn into_attribute_value(self) -> <T as IntoAttributeValue>::Output
Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters
when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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> IntoMaybeErased for Twhere
T: RenderHtml,
impl<T> IntoMaybeErased for Twhere
T: RenderHtml,
§fn into_maybe_erased(self) -> <T as IntoMaybeErased>::Output
fn into_maybe_erased(self) -> <T as IntoMaybeErased>::Output
§impl<T> IntoRender for Twhere
T: Render,
impl<T> IntoRender for Twhere
T: Render,
§fn into_render(self) -> <T as IntoRender>::Output
fn into_render(self) -> <T as IntoRender>::Output
Source§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self
into T
, while performing the appropriate scaling,
rounding and clamping.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> SerializableKey for T
impl<T> SerializableKey for T
§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
§fn into_taken(self) -> T
fn into_taken(self) -> T
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Lower case
letters are used (e.g. f9b4ca
)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Upper case
letters are used (e.g. F9B4CA
)§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.
Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors
fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read more