/// Converts a given value into a string. This should
/// eventually be customizable.
Converts a given value into a string. This should
eventually be customizable.
Converts a given value into a string . This should eventually be customizable .
fn stringify(&self, db: &dyn crate::Db, value: Value) -> String {
        let Some(p) = self.permission_str(value.permission) else {
            return "(expired)".to_string();
        };
        match &self[value.object] {
            ObjectData::String(s) => s.to_string(),
            ObjectData::Bool(v) => format!("{}", v),
            ObjectData::SignedInt(v) => format!("{}_i", v),
            ObjectData::Float(v) => format!("{}", v),
            ObjectData::UnsignedInt(v) => format!("{}_u", v),
            ObjectData::Int(v) => format!("{}", v),
            ObjectData::Unit(_) => "()".to_string(),
            ObjectData::Intrinsic(i) => i.as_str(db).to_string(),
            ObjectData::Function(f) => f.name(db).as_str(db).to_string(),
            ObjectData::ThunkFn(f) => {
                self.object_string(db, p, Some(f.function.name(db)), &f.arguments)
            }
            ObjectData::Instance(i) => self.object_string(db, p, Some(i.class.name(db)), &i.fields),
            ObjectData::Class(c) => c.name(db).as_str(db).to_string(),
            ObjectData::ThunkRust(r) => format!("{p} {r:?}"),
            ObjectData::Tuple(t) => self.object_string(db, p, None, &t.fields),
        }
    }
fn stringify ( & self , db : & dyn crate :: Db , value : Value ) -> String { let Some ( p ) = self . permission_str ( value . permission ) else { return " " . to_string ( ) ; } ; match & self [ value . object ] { ObjectData :: String ( s ) => s . to_string ( ) , ObjectData :: Bool ( v ) => format ! ( " " v ) , ObjectData :: SignedInt ( v ) => format ! ( " " v ) , ObjectData :: Float ( v ) => format ! ( " " v ) , ObjectData :: UnsignedInt ( v ) => format ! ( " " v ) , ObjectData :: Int ( v ) => format ! ( " " v ) , ObjectData :: Unit ( _ ) => " " . to_string ( ) , ObjectData :: Intrinsic ( i ) => i . as_str ( db ) . to_string ( ) , ObjectData :: Function ( f ) => f . name ( db ) . as_str ( db ) . to_string ( ) , ObjectData :: ThunkFn ( f ) => { self . object_string ( db , p , Some ( f . function . name ( db ) ) , & f . arguments ) } ObjectData :: Instance ( i ) => self . object_string ( db , p , Some ( i . class . name ( db ) ) , & i . fields ) , ObjectData :: Class ( c ) => c . name ( db ) . as_str ( db ) . to_string ( ) , ObjectData :: ThunkRust ( r ) => format ! ( " " ) , ObjectData :: Tuple ( t ) => self . object_string ( db , p , None , & t . fields ) , } }
Converts a given value into a string.
Converts a given value into a string .
&self
db
&dyn crate::Db
value
Value