Struct solana_sdk::sysvar::slot_hashes::SlotHashes [−][src]
Implementations
impl SlotHashes
[src]
pub fn add(&mut self, slot: u64, hash: Hash)
[src]
pub fn get(&self, slot: &u64) -> Option<&Hash>
[src]
pub fn new(slot_hashes: &[(u64, Hash)]) -> SlotHashes
[src]
Methods from Deref<Target = Vec<(u64, Hash), Global>>
pub fn capacity(&self) -> usize
1.0.0[src]
Returns the number of elements the vector can hold without reallocating.
Examples
let vec: Vec<i32> = Vec::with_capacity(10); assert_eq!(vec.capacity(), 10);
pub fn as_slice(&self) -> &[T]
1.7.0[src]
Extracts a slice containing the entire vector.
Equivalent to &s[..]
.
Examples
use std::io::{self, Write}; let buffer = vec![1, 2, 3, 5, 8]; io::sink().write(buffer.as_slice()).unwrap();
pub fn as_ptr(&self) -> *const T
1.37.0[src]
Returns a raw pointer to the vector’s buffer.
The caller must ensure that the vector outlives the pointer this function returns, or else it will end up pointing to garbage. Modifying the vector may cause its buffer to be reallocated, which would also make any pointers to it invalid.
The caller must also ensure that the memory the pointer (non-transitively) points to
is never written to (except inside an UnsafeCell
) using this pointer or any pointer
derived from it. If you need to mutate the contents of the slice, use as_mut_ptr
.
Examples
let x = vec![1, 2, 4]; let x_ptr = x.as_ptr(); unsafe { for i in 0..x.len() { assert_eq!(*x_ptr.add(i), 1 << i); } }
pub fn allocator(&self) -> &A
[src]
allocator_api
)Returns a reference to the underlying allocator.
pub fn len(&self) -> usize
1.0.0[src]
Returns the number of elements in the vector, also referred to as its ‘length’.
Examples
let a = vec![1, 2, 3]; assert_eq!(a.len(), 3);
pub fn is_empty(&self) -> bool
1.0.0[src]
Returns true
if the vector contains no elements.
Examples
let mut v = Vec::new(); assert!(v.is_empty()); v.push(1); assert!(!v.is_empty());
Trait Implementations
impl Debug for SlotHashes
[src]
impl Default for SlotHashes
[src]
pub fn default() -> SlotHashes
[src]
impl Deref for SlotHashes
[src]
type Target = Vec<(u64, Hash), Global>
The resulting type after dereferencing.
pub fn deref(&self) -> &<SlotHashes as Deref>::Target
[src]
impl<'de> Deserialize<'de> for SlotHashes
[src]
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<SlotHashes, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<SlotHashes, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl FromIterator<(u64, Hash)> for SlotHashes
[src]
pub fn from_iter<I>(iter: I) -> SlotHashes where
I: IntoIterator<Item = (u64, Hash)>,
[src]
I: IntoIterator<Item = (u64, Hash)>,
impl PartialEq<SlotHashes> for SlotHashes
[src]
pub fn eq(&self, other: &SlotHashes) -> bool
[src]
pub fn ne(&self, other: &SlotHashes) -> bool
[src]
impl Serialize for SlotHashes
[src]
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
impl StructuralPartialEq for SlotHashes
[src]
impl Sysvar for SlotHashes
[src]
pub fn size_of() -> usize
[src]
pub fn from_account_info(
account_info: &AccountInfo<'_>
) -> Result<Self, ProgramError>
[src]
account_info: &AccountInfo<'_>
) -> Result<Self, ProgramError>
pub fn to_account_info(&self, account_info: &mut AccountInfo<'_>) -> Option<()>
[src]
impl SysvarId for SlotHashes
[src]
Auto Trait Implementations
impl RefUnwindSafe for SlotHashes
impl Send for SlotHashes
impl Sync for SlotHashes
impl Unpin for SlotHashes
impl UnwindSafe for SlotHashes
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Typeable for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,