1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* Copyright (c) 2024 Andrew Rowan Barlow. Licensed under the EUPL-1.2
* or later. You may obtain a copy of the licence at
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12. A copy
* of the EUPL-1.2 licence in English is given in LICENCE.txt which is
* found in the root directory of this repository.
*
* Author: Andrew Rowan Barlow <a.barlow.dev@gmail.com>
*/
use ;
/// An iterator of the qubits that label the product state in the computational basis, from left to
/// right in braket notation.
///
/// # Example
/// ```
/// use quantr::states::{ProductState, Qubit, ProductStateIter};
///
/// let state = ProductState::new(&[Qubit::One, Qubit::Zero, Qubit::Zero]).unwrap(); // |100>
///
/// let mut state_iter: ProductStateIter = state.into_iter();
///
/// assert_eq!(state_iter.next(), Some(Qubit::One));
/// assert_eq!(state_iter.next(), Some(Qubit::Zero));
/// assert_eq!(state_iter.next(), Some(Qubit::Zero));
/// assert_eq!(state_iter.next(), None);
/// ```