Mårten Kongstad | 867a349 | 2023-04-25 15:06:30 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2023 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | //! `aconfig` is a build time tool to manage build time configurations, such as feature flags. |
| 18 | |
Mårten Kongstad | bb52072 | 2023-04-26 13:16:41 +0200 | [diff] [blame^] | 19 | use anyhow::Result; |
Mårten Kongstad | 867a349 | 2023-04-25 15:06:30 +0200 | [diff] [blame] | 20 | |
Mårten Kongstad | bb52072 | 2023-04-26 13:16:41 +0200 | [diff] [blame^] | 21 | mod aconfig; |
Mårten Kongstad | fe753f5 | 2023-04-26 09:13:03 +0200 | [diff] [blame] | 22 | mod protos; |
Mårten Kongstad | fe753f5 | 2023-04-26 09:13:03 +0200 | [diff] [blame] | 23 | |
Mårten Kongstad | bb52072 | 2023-04-26 13:16:41 +0200 | [diff] [blame^] | 24 | use aconfig::{Flag, Override}; |
Mårten Kongstad | 867a349 | 2023-04-25 15:06:30 +0200 | [diff] [blame] | 25 | |
Mårten Kongstad | bb52072 | 2023-04-26 13:16:41 +0200 | [diff] [blame^] | 26 | fn main() -> Result<()> { |
| 27 | let flag = Flag::try_from_text_proto(r#"id: "a" description: "description of a" value: true"#)?; |
| 28 | println!("{:?}", flag); |
| 29 | let flags = Flag::try_from_text_proto_list( |
| 30 | r#"flag { id: "a" description: "description of a" value: true }"#, |
| 31 | )?; |
| 32 | println!("{:?}", flags); |
| 33 | let override_ = Override::try_from_text_proto(r#"id: "foo" value: true"#)?; |
| 34 | println!("{:?}", override_); |
| 35 | let overrides = Override::try_from_text_proto_list(r#"override { id: "foo" value: true }"#)?; |
| 36 | println!("{:?}", overrides); |
| 37 | Ok(()) |
Mårten Kongstad | 867a349 | 2023-04-25 15:06:30 +0200 | [diff] [blame] | 38 | } |