pub struct StrategyId(/* private fields */);Expand description
Represents a valid strategy ID.
Implementations§
Source§impl StrategyId
impl StrategyId
Sourcepub fn new_checked<T: AsRef<str>>(value: T) -> CorrectnessResult<Self>
pub fn new_checked<T: AsRef<str>>(value: T) -> CorrectnessResult<Self>
Creates a new StrategyId instance.
Must be correctly formatted with two valid strings either side of a hyphen. It is expected a strategy ID is the class name of the strategy, with an order ID tag number separated by a hyphen.
Example: “EMACross-001”.
The reason for the numerical component of the ID is so that order and position IDs do not collide with those from another strategy within the node instance.
§Errors
Returns an error if:
valueis not a valid ASCII string.valueis not “EXTERNAL” and does not contain a hyphen ‘-’ separator.- Either the name or tag part (before/after the hyphen) is empty.
pub fn external() -> Self
pub fn is_external(&self) -> bool
Trait Implementations§
Source§impl AsRef<str> for StrategyId
impl AsRef<str> for StrategyId
Source§impl Clone for StrategyId
impl Clone for StrategyId
Source§fn clone(&self) -> StrategyId
fn clone(&self) -> StrategyId
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StrategyId
impl Debug for StrategyId
Source§impl<'de> Deserialize<'de> for StrategyId
impl<'de> Deserialize<'de> for StrategyId
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Display for StrategyId
impl Display for StrategyId
Source§impl From<&str> for StrategyId
impl From<&str> for StrategyId
Source§impl From<String> for StrategyId
impl From<String> for StrategyId
Source§impl<'a, 'py> FromPyObject<'a, 'py> for StrategyIdwhere
Self: Clone,
impl<'a, 'py> FromPyObject<'a, 'py> for StrategyIdwhere
Self: Clone,
Source§impl Hash for StrategyId
impl Hash for StrategyId
Source§impl<'py> IntoPyObject<'py> for StrategyId
impl<'py> IntoPyObject<'py> for StrategyId
Source§type Target = StrategyId
type Target = StrategyId
Source§type Output = Bound<'py, <StrategyId as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <StrategyId as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl Ord for StrategyId
impl Ord for StrategyId
Source§fn cmp(&self, other: &StrategyId) -> Ordering
fn cmp(&self, other: &StrategyId) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for StrategyId
impl PartialEq for StrategyId
Source§impl PartialOrd for StrategyId
impl PartialOrd for StrategyId
Source§impl PyClass for StrategyId
impl PyClass for StrategyId
Source§impl PyClassImpl for StrategyId
impl PyClassImpl for StrategyId
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = /// Represents a valid strategy ID.
const RAW_DOC: &'static CStr = /// Represents a valid strategy ID.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<StrategyId as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<StrategyId>
type Layout = <<StrategyId as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<StrategyId>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
type Inventory = Pyo3MethodsInventoryForStrategyId
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
§fn dict_offset() -> Option<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyClassNewTextSignature for StrategyId
impl PyClassNewTextSignature for StrategyId
const TEXT_SIGNATURE: &'static str = "(value)"
Source§impl PyStubType for StrategyId
impl PyStubType for StrategyId
Source§fn type_output() -> TypeInfo
fn type_output() -> TypeInfo
§fn type_input() -> TypeInfo
fn type_input() -> TypeInfo
Source§impl PyTypeInfo for StrategyId
impl PyTypeInfo for StrategyId
Source§const NAME: &str = <Self as ::pyo3::PyClass>::NAME
const NAME: &str = <Self as ::pyo3::PyClass>::NAME
prefer using ::type_object(py).name() to get the correct runtime value
Source§const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
prefer using ::type_object(py).module() to get the correct runtime value
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.Source§impl Serialize for StrategyId
impl Serialize for StrategyId
Source§impl TestDefault for StrategyId
impl TestDefault for StrategyId
Source§fn test_default() -> Self
fn test_default() -> Self
Creates a new test default StrategyId instance.
impl Copy for StrategyId
impl DerefToPyAny for StrategyId
impl Eq for StrategyId
impl StructuralPartialEq for StrategyId
Auto Trait Implementations§
impl Freeze for StrategyId
impl RefUnwindSafe for StrategyId
impl Send for StrategyId
impl Sync for StrategyId
impl Unpin for StrategyId
impl UnsafeUnpin for StrategyId
impl UnwindSafe for StrategyId
Blanket Implementations§
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
Source§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
§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.§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
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<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self into an owned Python object, dropping type information and unbinding it
from the 'py lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self into a Python object. Read more§impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
§fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>
fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>
§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
§const NAME: &'static str = T::NAME
const NAME: &'static str = T::NAME
Use ::classinfo_object() instead and format the type name at runtime. Note that using built-in cast features is often better than manual PyTypeCheck usage.
§fn type_check(object: &Bound<'_, PyAny>) -> bool
fn type_check(object: &Bound<'_, PyAny>) -> bool
§fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
isinstance and issubclass function. Read more