pub struct PropertyBuilder<'a, C, T: Export, S = InvalidSetter<'a>, G = InvalidGetter<'a>> { /* private fields */ }
Expand description

Builder type used to register a property on a NativeClass.

Implementations§

source§

impl<'a, C, T, S, G> PropertyBuilder<'a, C, T, S, G>where
    C: NativeClass,
    T: Export,
    S: RawSetter<C, T>,
    G: RawGetter<C, T>,

source

pub fn done(self)

Register the property built with this builder.

source

pub fn with_setter<NS>(
    self,
    setter: NS
) -> PropertyBuilder<'a, C, T, Setter<Mut, NS>, G>where
    Setter<Mut, NS>: RawSetter<C, T>,

Provides a setter function with the signature fn(&mut C, owner: C::Base, value: T) where C is the NativeClass type being registered and T is the type of the property.

source

pub fn with_shr_setter<NS>(
    self,
    setter: NS
) -> PropertyBuilder<'a, C, T, Setter<Shr, NS>, G>where
    Setter<Shr, NS>: RawSetter<C, T>,

Provides a setter function with the signature fn(&C, owner: C::Base, value: T) where C is the NativeClass type being registered and T is the type of the property.

“shr” stands for “shared reference”, as opposed to the more common &mut self.

source

pub fn with_getter<NG>(
    self,
    getter: NG
) -> PropertyBuilder<'a, C, T, S, Getter<Shr, Owned, NG>>where
    Getter<Shr, Owned, NG>: RawGetter<C, T>,

Provides a getter function with the signature fn(&C, owner: C::Base) -> T, where C is the NativeClass type being registered and T is the type of the property.

source

pub fn with_ref_getter<NG>(
    self,
    getter: NG
) -> PropertyBuilder<'a, C, T, S, Getter<Shr, Ref, NG>>where
    Getter<Shr, Ref, NG>: RawGetter<C, T>,

Provides a getter function with the signature fn(&C, owner: C::Base) -> &T, where C is the NativeClass type being registered and T is the type of the property.

source

pub fn with_mut_getter<NG>(
    self,
    getter: NG
) -> PropertyBuilder<'a, C, T, S, Getter<Mut, Owned, NG>>where
    Getter<Mut, Owned, NG>: RawGetter<C, T>,

Provides a getter function with the signature fn(&mut C, owner: C::Base) -> T, where C is the NativeClass type being registered and T is the type of the property.

source

pub fn with_mut_ref_getter<NG>(
    self,
    getter: NG
) -> PropertyBuilder<'a, C, T, S, Getter<Mut, Ref, NG>>where
    Getter<Mut, Ref, NG>: RawGetter<C, T>,

Provides a getter function with the signature fn(&mut C, owner: C::Base) -> &T, where C is the NativeClass type being registered and T is the type of the property.

source

pub fn with_default(self, default: T) -> Self

Sets a default value for the property as a hint to the editor. The setter may or may not be actually called with this value.

source

pub fn with_hint(self, hint: T::Hint) -> Self

Sets an editor hint.

source

pub fn with_usage(self, usage: PropertyUsage) -> Self

Sets a property usage.

source

pub fn with_rpc_mode(self, rpc_mode: RpcMode) -> Self

Sets a RPC mode.

Trait Implementations§

source§

impl<'a, C: Debug, T: Debug + Export, S: Debug, G: Debug> Debug for PropertyBuilder<'a, C, T, S, G>where
    T::Hint: Debug,

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, C, T, S = InvalidSetter<'a>, G = InvalidGetter<'a>> !RefUnwindSafe for PropertyBuilder<'a, C, T, S, G>

§

impl<'a, C, T, S = InvalidSetter<'a>, G = InvalidGetter<'a>> !Send for PropertyBuilder<'a, C, T, S, G>

§

impl<'a, C, T, S = InvalidSetter<'a>, G = InvalidGetter<'a>> !Sync for PropertyBuilder<'a, C, T, S, G>

§

impl<'a, C, T, S, G> Unpin for PropertyBuilder<'a, C, T, S, G>where
    G: Unpin,
    S: Unpin,
    T: Unpin,
    <T as Export>::Hint: Unpin,

§

impl<'a, C, T, S = InvalidSetter<'a>, G = InvalidGetter<'a>> !UnwindSafe for PropertyBuilder<'a, C, T, S, G>

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · 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, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.