MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / trim

Function trim

aiscript-vm/src/builtins/string.rs:76–85  ·  view source on GitHub ↗

Trim functions

(
    mc: &'gc Mutation<'gc>,
    receiver: Value<'gc>,
    _args: Vec<Value<'gc>>,
)

Source from the content-addressed store, hash-verified

74
75// Trim functions
76fn trim<'gc>(
77 mc: &'gc Mutation<'gc>,
78 receiver: Value<'gc>,
79 _args: Vec<Value<'gc>>,
80) -> Result<Value<'gc>, VmError> {
81 let s = receiver.as_string_value()?;
82 let trimmed = s.as_str().trim();
83 // Ok(Value::String(mc.intern(trimmed.as_bytes())))
84 Ok(Value::IoString(Gc::new(mc, trimmed.to_owned())))
85}
86
87fn trim_start<'gc>(
88 mc: &'gc Mutation<'gc>,

Callers

nothing calls this directly

Calls 2

as_string_valueMethod · 0.80
as_strMethod · 0.45

Tested by

no test coverage detected