microsoft/qdk

Public

mirrored from https://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.18.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

source/resource_estimator/src/estimates/factory/empty.rs

62lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4use std::marker::PhantomData;
5
6use crate::estimates::{ErrorCorrection, Factory, FactoryBuilder};
7
8pub struct NoFactories<E> {
9 phantom: PhantomData<E>,
10}
11
12impl<E> Default for NoFactories<E> {
13 fn default() -> Self {
14 Self {
15 phantom: PhantomData,
16 }
17 }
18}
19
20#[derive(Clone)]
21pub struct NoFactory<P> {
22 phantom: PhantomData<P>,
23}
24
25impl<E: ErrorCorrection<Parameter = impl Clone>> FactoryBuilder<E> for NoFactories<E> {
26 type Factory = NoFactory<E::Parameter>;
27
28 fn find_factories(
29 &self,
30 _ftp: &E,
31 _qubit: &std::rc::Rc<<E as ErrorCorrection>::Qubit>,
32 _magic_state_type: usize,
33 _output_error_rate: f64,
34 _max_code_parameter: &<E as ErrorCorrection>::Parameter,
35 ) -> Result<Vec<std::borrow::Cow<Self::Factory>>, String> {
36 unreachable!()
37 }
38
39 fn num_magic_state_types(&self) -> usize {
40 0
41 }
42}
43
44impl<P: Clone> Factory for NoFactory<P> {
45 type Parameter = P;
46
47 fn physical_qubits(&self) -> u64 {
48 unreachable!()
49 }
50
51 fn duration(&self) -> u64 {
52 unreachable!()
53 }
54
55 fn num_output_states(&self) -> u64 {
56 unreachable!()
57 }
58
59 fn max_code_parameter(&self) -> Option<std::borrow::Cow<Self::Parameter>> {
60 unreachable!()
61 }
62}
63