microsoft/qdk

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.2.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

compiler/qsc/src/target.rs

43lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4use std::str::FromStr;
5
6use qsc_frontend::compile::RuntimeCapabilityFlags;
7
8#[derive(Clone, Copy, Debug, PartialEq)]
9pub enum Profile {
10 Unrestricted,
11 Base,
12}
13
14impl Profile {
15 #[must_use]
16 pub fn to_str(&self) -> &'static str {
17 match self {
18 Self::Unrestricted => "Unrestricted",
19 Self::Base => "Base",
20 }
21 }
22}
23
24impl From<Profile> for RuntimeCapabilityFlags {
25 fn from(value: Profile) -> Self {
26 match value {
27 Profile::Unrestricted => Self::all(),
28 Profile::Base => Self::empty(),
29 }
30 }
31}
32
33impl FromStr for Profile {
34 type Err = ();
35
36 fn from_str(s: &str) -> Result<Self, Self::Err> {
37 match s {
38 "Unrestricted" | "unrestricted" => Ok(Self::Unrestricted),
39 "Base" | "base" => Ok(Self::Base),
40 _ => Err(()),
41 }
42 }
43}
44