cedar_policy_formatter/pprint/
config.rs

1/*
2 * Copyright Cedar Contributors
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 *      https://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
17use super::token::WrappedToken;
18
19/// Configuraton struct that specifies line width and indentation width
20#[derive(Debug, Clone)]
21pub struct Config {
22    pub line_width: usize,
23    pub indent_width: isize,
24}
25
26impl Default for Config {
27    fn default() -> Self {
28        Self {
29            line_width: 80,
30            indent_width: 2,
31        }
32    }
33}
34
35#[derive(Debug)]
36pub struct Context<'a, 'src> {
37    pub config: &'a Config,
38    pub tokens: Vec<WrappedToken<'src>>,
39}