Movatterモバイル変換


[0]ホーム

URL:


[][src]Enumrustpython_vm::pyobject::Either

pub enum Either<A, B> {    A(A),    B(B),}

Variants

A(A)
B(B)

Methods

impl<A: PyValue, B: PyValue>Either<PyRef<A>,PyRef<B>>[src]

pub fninto_object(self) ->PyObjectRef[src]

Trait Implementations

impl<A, B>TryFromObject forEither<A, B>where
    A:TryFromObject,
    B:TryFromObject
[src]

This allows a builtin method to accept arguments that may be one of twotypes, raising aTypeError if it is neither.

Example

userustpython_vm::VirtualMachine;userustpython_vm::obj::{objstr::PyStringRef,objint::PyIntRef};userustpython_vm::pyobject::Either;fndo_something(arg:Either<PyIntRef,PyStringRef>,vm:&VirtualMachine) {matcharg {Either::A(int)=> {// do something with int        }Either::B(string)=> {// do something with string        }    }}

fntry_from_object(vm: &VirtualMachine, obj:PyObjectRef) ->PyResult<Self>[src]

Auto Trait Implementations

impl<A, B>RefUnwindSafe forEither<A, B>where
    A:RefUnwindSafe,
    B:RefUnwindSafe

impl<A, B>Send forEither<A, B>where
    A:Send,
    B:Send

impl<A, B>Sync forEither<A, B>where
    A:Sync,
    B:Sync

impl<A, B>Unpin forEither<A, B>where
    A:Unpin,
    B:Unpin

impl<A, B>UnwindSafe forEither<A, B>where
    A:UnwindSafe,
    B:UnwindSafe

Blanket Implementations

impl<T>Any for Twhere
    T: 'static + ?Sized
[src]

fntype_id(&self) ->TypeId[src]

impl<T>Borrow<T> for Twhere
    T: ?Sized
[src]

fnborrow(&self) ->&T[src]

impl<T>BorrowMut<T> for Twhere
    T: ?Sized
[src]

fnborrow_mut(&mut self) ->&mutT[src]

impl<T>From<T> for T[src]

fnfrom(t: T) -> T[src]

impl<T>FromArgs for Twhere
    T:TryFromObject
[src]

fnarity() ->RangeInclusive<usize>[src]

fnfrom_args(&VirtualMachine, &mutPyFuncArgs) ->Result<T,ArgumentError>[src]

impl<T, U>Into<U> for Twhere
    U:From<T>, 
[src]

fninto(self) -> U[src]

impl<T> Same<T> for T

typeOutput = T

Should always beSelf

impl<T, U>TryFrom<U> for Twhere
    U:Into<T>, 
[src]

typeError =Infallible

The type returned in the event of a conversion error.

fntry_from(value: U) ->Result<T, <T asTryFrom<U>>::Error>[src]

impl<T, U>TryInto<U> for Twhere
    U:TryFrom<T>, 
[src]

typeError = <U asTryFrom<T>>::Error

The type returned in the event of a conversion error.

fntry_into(self) ->Result<U, <U asTryFrom<T>>::Error>[src]

impl<V, T> VZip<V> for Twhere
    V: MultiLane<T>, 

fnvzip(self) -> V


[8]ページ先頭

©2009-2025 Movatter.jp