object_rainbow/impls/
cstring.rs

1use std::ffi::CString;
2
3use crate::*;
4
5impl ToOutput for CString {
6    fn to_output(&self, output: &mut dyn Output) {
7        self.as_c_str().to_output(output);
8    }
9}
10
11impl InlineOutput for CString {}
12
13impl ListHashes for CString {}
14impl Topological for CString {}
15impl Tagged for CString {}
16
17impl<I: ParseInput> Parse<I> for CString {
18    fn parse(input: I) -> crate::Result<Self> {
19        Self::parse_as_inline(input)
20    }
21}
22
23impl<I: ParseInput> ParseInline<I> for CString {
24    fn parse_inline(input: &mut I) -> crate::Result<Self> {
25        let mut vec = Vec::new();
26        while let x = input.parse_inline()?
27            && x != 0
28        {
29            vec.push(x);
30        }
31        Ok(Self::new(vec).expect("should stop on zero"))
32    }
33}
34
35impl MaybeHasNiche for CString {
36    type MnArray = NoNiche<NicheForUnsized>;
37}