swamp_code_gen/
ctx.rs

1/*
2 * Copyright (c) Peter Bjorklund. All rights reserved. https://github.com/swamp/swamp
3 * Licensed under the MIT License. See LICENSE in the project root for license information.
4 */
5#[derive(Clone, Default)]
6pub struct Context {
7    pub comment: String,
8}
9
10impl Context {
11    #[must_use]
12    pub const fn new() -> Self {
13        Self {
14            comment: String::new(),
15        }
16    }
17
18    #[must_use]
19    pub fn with_comment(self, comment: &str) -> Self {
20        Self {
21            comment: comment.to_string(),
22        }
23    }
24    pub(crate) fn comment(&self) -> &str {
25        &self.comment
26    }
27}