pub struct OracleConfig {
pub switchboard: SwitchboardOracleConfig,
pub pyth: PythOracleConfig,
/* private fields */
}Expand description
Oracle configuration stored by vault and asset accounts.
The serialized shape includes every supported oracle implementation from
the start. Switching implementations only changes kind, so account data
size remains stable.
Fields§
§switchboard: SwitchboardOracleConfig§pyth: PythOracleConfigImplementations§
Source§impl OracleConfig
impl OracleConfig
pub const fn raw_kind(&self) -> u8
pub const fn kind(&self) -> Result<OracleKind, InvalidOracleKind>
pub const fn validate(&self) -> Result<(), InvalidOracleKind>
pub const fn switchboard(config: SwitchboardOracleConfig) -> Self
pub const fn pyth(config: PythOracleConfig) -> Self
pub const fn with_configs( kind: OracleKind, switchboard: SwitchboardOracleConfig, pyth: PythOracleConfig, ) -> Self
Trait Implementations§
Source§impl Clone for OracleConfig
impl Clone for OracleConfig
Source§fn clone(&self) -> OracleConfig
fn clone(&self) -> OracleConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for OracleConfig
Source§impl Debug for OracleConfig
impl Debug for OracleConfig
Source§impl Default for OracleConfig
impl Default for OracleConfig
impl Eq for OracleConfig
Source§impl PartialEq for OracleConfig
impl PartialEq for OracleConfig
Source§fn eq(&self, other: &OracleConfig) -> bool
fn eq(&self, other: &OracleConfig) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<'de, WincodeConfig: Config> SchemaRead<'de, WincodeConfig> for OracleConfig
impl<'de, WincodeConfig: Config> SchemaRead<'de, WincodeConfig> for OracleConfig
type Dst = OracleConfig
Source§fn read(
reader: impl Reader<'de>,
dst: &mut MaybeUninit<Self::Dst>,
) -> ReadResult<()>
fn read( reader: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> ReadResult<()>
Source§impl<WincodeConfig: Config> SchemaWrite<WincodeConfig> for OracleConfig
impl<WincodeConfig: Config> SchemaWrite<WincodeConfig> for OracleConfig
impl StructuralPartialEq for OracleConfig
Source§impl<WincodeConfig: Config> ZeroCopy<WincodeConfig> for OracleConfigwhere
for<'_wincode_internal> SwitchboardOracleConfig: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> PythOracleConfig: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> u8: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> [u8; 7]: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> Assert<{ _ }>: IsTrue,
impl<WincodeConfig: Config> ZeroCopy<WincodeConfig> for OracleConfigwhere
for<'_wincode_internal> SwitchboardOracleConfig: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> PythOracleConfig: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> u8: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> [u8; 7]: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> Assert<{ _ }>: IsTrue,
Source§fn from_bytes<'de>(bytes: &'de [u8], config: C) -> Result<&'de Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
fn from_bytes<'de>(bytes: &'de [u8], config: C) -> Result<&'de Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
Like
crate::ZeroCopy::from_bytes, but allows the caller to provide a custom configuration.Source§fn from_bytes_mut<'de>(
bytes: &'de mut [u8],
config: C,
) -> Result<&'de mut Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
fn from_bytes_mut<'de>(
bytes: &'de mut [u8],
config: C,
) -> Result<&'de mut Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
Like
crate::ZeroCopy::from_bytes_mut, but allows the caller to provide a custom configuration.Auto Trait Implementations§
impl Freeze for OracleConfig
impl RefUnwindSafe for OracleConfig
impl Send for OracleConfig
impl Sync for OracleConfig
impl Unpin for OracleConfig
impl UnsafeUnpin for OracleConfig
impl UnwindSafe for OracleConfig
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'de, T, C> Deserialize<'de, C> for Twhere
C: Config,
T: SchemaRead<'de, C>,
impl<'de, T, C> Deserialize<'de, C> for Twhere
C: Config,
T: SchemaRead<'de, C>,
Source§impl<'de, T> Deserialize<'de> for Twhere
T: SchemaRead<'de, Configuration>,
impl<'de, T> Deserialize<'de> for Twhere
T: SchemaRead<'de, Configuration>,
Source§impl<T> DeserializeOwned for Twhere
T: SchemaReadOwned<Configuration>,
impl<T> DeserializeOwned for Twhere
T: SchemaReadOwned<Configuration>,
Source§fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
Deserialize from the given
Reader into a new Self::Dst.Source§fn deserialize_from_into<'de>(
src: impl Reader<'de>,
dst: &mut MaybeUninit<Self::Dst>,
) -> Result<(), ReadError>
fn deserialize_from_into<'de>( src: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>
Deserialize from the given
Reader into dst.Source§impl<T, C> DeserializeOwned<C> for Twhere
C: Config,
T: SchemaReadOwned<C>,
impl<T, C> DeserializeOwned<C> for Twhere
C: Config,
T: SchemaReadOwned<C>,
Source§fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
Deserialize from the given
Reader into a new Self::Dst.Source§fn deserialize_from_into<'de>(
src: impl Reader<'de>,
dst: &mut MaybeUninit<Self::Dst>,
) -> Result<(), ReadError>
fn deserialize_from_into<'de>( src: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>
Deserialize from the given
Reader into dst.impl<T, C> SchemaReadOwned<C> for Twhere
C: ConfigCore,
T: for<'de> SchemaRead<'de, C>,
Source§impl<T> Serialize for T
impl<T> Serialize for T
Source§fn serialize(src: &Self::Src) -> Result<Vec<u8>, WriteError>
fn serialize(src: &Self::Src) -> Result<Vec<u8>, WriteError>
Serialize a serializable type into a
Vec of bytes.Source§fn serialize_into(dst: impl Writer, src: &Self::Src) -> Result<(), WriteError>
fn serialize_into(dst: impl Writer, src: &Self::Src) -> Result<(), WriteError>
Serialize a serializable type into the given byte buffer.
Source§fn serialized_size(src: &Self::Src) -> Result<u64, WriteError>
fn serialized_size(src: &Self::Src) -> Result<u64, WriteError>
Get the size in bytes of the type when serialized.
Source§impl<T, C> Serialize<C> for T
impl<T, C> Serialize<C> for T
Source§fn serialize(src: &Self::Src, config: C) -> Result<Vec<u8>, WriteError>
fn serialize(src: &Self::Src, config: C) -> Result<Vec<u8>, WriteError>
Serialize a serializable type into a
Vec of bytes.Source§fn serialize_into(
dst: impl Writer,
src: &Self::Src,
config: C,
) -> Result<(), WriteError>
fn serialize_into( dst: impl Writer, src: &Self::Src, config: C, ) -> Result<(), WriteError>
Serialize a serializable type into the given
Writer.Source§fn serialized_size(src: &Self::Src, config: C) -> Result<u64, WriteError>
fn serialized_size(src: &Self::Src, config: C) -> Result<u64, WriteError>
Get the size in bytes of the type when serialized.