pub struct MeasRegistry { /* private fields */ }Expand description
Allocator and lookup table for a circuit’s measurement ids.
Records are kept strictly sorted by id. Dense ids use direct indexing; sparse lookups fall back to binary search. On the wire only the records are stored; the next-id counter is recomputed on decode (see the serde impls) rather than trusted.
Implementations§
Source§impl MeasRegistry
impl MeasRegistry
Sourcepub fn allocate(&mut self, qubits: impl IntoIterator<Item = IVec2>) -> Vec<u32>
pub fn allocate(&mut self, qubits: impl IntoIterator<Item = IVec2>) -> Vec<u32>
Allocates one sequential id per qubit, appending a record for each, and returns the ids in input order.
Sourcepub fn allocate_one(&mut self, qubit: IVec2) -> u32
pub fn allocate_one(&mut self, qubit: IVec2) -> u32
Allocates a single sequential id for qubit, appending its record —
the Self::allocate core without the return Vec, for hot callers
that allocate one id at a time.
§Panics
Panics if the measurement-id space is exhausted.
Sourcepub fn reserve(&mut self, id: u32, qubit: IVec2)
pub fn reserve(&mut self, id: u32, qubit: IVec2)
Reserve id for qubit, keeping the record list sorted. Reserving an
already-reserved id for the same qubit is a no-op.
§Panics
Panics if id is already reserved for a different qubit or is u32::MAX.
The registry is unchanged if this check fails.
Sourcepub fn record(&self, id: u32) -> Option<&MeasRecord>
pub fn record(&self, id: u32) -> Option<&MeasRecord>
Borrows the record for id, or None if it is not allocated.
Sourcepub fn records(&self) -> &[MeasRecord]
pub fn records(&self) -> &[MeasRecord]
All records, sorted by id.
Trait Implementations§
Source§impl Clone for MeasRegistry
impl Clone for MeasRegistry
Source§fn clone(&self) -> MeasRegistry
fn clone(&self) -> MeasRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MeasRegistry
impl Debug for MeasRegistry
Source§impl Default for MeasRegistry
impl Default for MeasRegistry
Source§fn default() -> MeasRegistry
fn default() -> MeasRegistry
Source§impl<'de> Deserialize<'de> for MeasRegistry
impl<'de> Deserialize<'de> for MeasRegistry
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for MeasRegistry
Source§impl PartialEq for MeasRegistry
impl PartialEq for MeasRegistry
Source§impl Serialize for MeasRegistry
impl Serialize for MeasRegistry
impl StructuralPartialEq for MeasRegistry
Auto Trait Implementations§
impl Freeze for MeasRegistry
impl RefUnwindSafe for MeasRegistry
impl Send for MeasRegistry
impl Sync for MeasRegistry
impl Unpin for MeasRegistry
impl UnsafeUnpin for MeasRegistry
impl UnwindSafe for MeasRegistry
Blanket Implementations§
§impl<T, BorrowedSelf> BitwiseMutViaBorrow<BorrowedSelf> for T
impl<T, BorrowedSelf> BitwiseMutViaBorrow<BorrowedSelf> for T
fn assign_index(&mut self, index: usize, to: bool)
fn negate_index(&mut self, index: usize)
fn clear_bits(&mut self)
fn assign_random(
&mut self,
bit_count: usize,
random_number_generator: &mut impl RngExt,
)where
BorrowedSelf: BitLength,
§impl<Bits, Other, BorrowedSelf, BorrowedOther> BitwisePairMutViaBorrow<Other, BorrowedSelf, BorrowedOther> for Bits
impl<Bits, Other, BorrowedSelf, BorrowedOther> BitwisePairMutViaBorrow<Other, BorrowedSelf, BorrowedOther> for Bits
fn assign(&mut self, other: &Other)
fn bitxor_assign(&mut self, other: &Other)
fn bitand_assign(&mut self, other: &Other)
fn bitor_assign(&mut self, other: &Other)
§impl<T, Other, BorrowedSelf, BorrowedOther> BitwisePairViaBorrow<Other, BorrowedSelf, BorrowedOther> for T
impl<T, Other, BorrowedSelf, BorrowedOther> BitwisePairViaBorrow<Other, BorrowedSelf, BorrowedOther> for T
§impl<T, BorrowedSelf> BitwiseViaBorrow<BorrowedSelf> for T
impl<T, BorrowedSelf> BitwiseViaBorrow<BorrowedSelf> for T
fn index(&self, index: usize) -> bool
fn weight(&self) -> usize
fn parity(&self) -> bool
fn is_zero(&self) -> bool
fn is_unit(&self, index: usize) -> bool
fn support<'a>(&'a self) -> impl SortedIteratorwhere
BorrowedSelf: 'a,
fn max_support(&self) -> Option<usize>
fn min_support(&self) -> Option<usize>
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<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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.