Movatterモバイル変換


[0]ホーム

URL:


[][src]Traitrustpython_vm::pyobject::TryFromObject

pub trait TryFromObject:Sized {    fntry_from_object(vm: &VirtualMachine, obj:PyObjectRef) ->PyResult<Self>;}

Implemented by any type that can be created from a Python object.

Any type that implementsTryFromObject is automaticallyFromArgs, andso can be accepted as a argument to a built-in function.

Required methods

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

Attempt to convert a Python object to a value of this type.

Loading content...

Implementations on Foreign Types

implTryFromObject forbool[src]

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

implTryFromObject forf32[src]

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

implTryFromObject forf64[src]

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

implTryFromObject forisize[src]

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

implTryFromObject fori8[src]

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

implTryFromObject fori16[src]

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

implTryFromObject fori32[src]

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

implTryFromObject fori64[src]

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

implTryFromObject forusize[src]

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

implTryFromObject foru8[src]

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

implTryFromObject foru16[src]

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

implTryFromObject foru32[src]

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

implTryFromObject foru64[src]

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

impl<T: TryFromObject>TryFromObject forOption<T>[src]

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

implTryFromObject forDuration[src]

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

Loading content...

Implementors

impl TryFromObject forExceptionCtor[src]

impl TryFromObject forPyBytesLike[src]

impl TryFromObject forRangeIndex[src]

impl TryFromObject forSequenceIndex[src]

impl TryFromObject forIntoPyBool[src]

impl TryFromObject forPyByteInner[src]

impl TryFromObject forIntoPyFloat[src]

impl TryFromObject forPyCallable[src]

impl TryFromObject forPyObjectRef[src]

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        }    }}

impl<T> TryFromObject forPyIterable<T>where
    T:TryFromObject
[src]

impl<T> TryFromObject forPyRef<T>where
    T:PyValue
[src]

Loading content...

[8]ページ先頭

©2009-2025 Movatter.jp