fn quote_type()

in serde-generate/src/swift.rs [133:169]


    fn quote_type(&self, format: &Format) -> String {
        use Format::*;
        match format {
            TypeName(x) => self.quote_qualified_name(x),
            Unit => "Unit".into(),
            Bool => "Bool".into(),
            I8 => "Int8".into(),
            I16 => "Int16".into(),
            I32 => "Int32".into(),
            I64 => "Int64".into(),
            I128 => "Int128".into(),
            U8 => "UInt8".into(),
            U16 => "UInt16".into(),
            U32 => "UInt32".into(),
            U64 => "UInt64".into(),
            U128 => "UInt128".into(),
            F32 => "Float".into(),
            F64 => "Double".into(),
            Char => "Character".into(),
            Str => "String".into(),
            Bytes => "[UInt8]".into(),

            Option(format) => format!("{}?", self.quote_type(format)),
            Seq(format) => format!("[{}]", self.quote_type(format)),
            Map { key, value } => {
                format!("[{}: {}]", self.quote_type(key), self.quote_type(value))
            }
            // Sadly, Swift tuples are not hashable.
            Tuple(formats) => format!("Tuple{}<{}>", formats.len(), self.quote_types(formats)),
            TupleArray { content, size: _ } => {
                // Sadly, there are no fixed-size arrays in Swift.
                format!("[{}]", self.quote_type(content))
            }

            Variable(_) => panic!("unexpected value"),
        }
    }