MCPcopy Create free account
hub / github.com/aiscriptdev/aiscript / trim_start

Function trim_start

aiscript-vm/src/builtins/string.rs:87–96  ·  view source on GitHub ↗
(
    mc: &'gc Mutation<'gc>,
    receiver: Value<'gc>,
    _args: Vec<Value<'gc>>,
)

Source from the content-addressed store, hash-verified

85}
86
87fn trim_start<'gc>(
88 mc: &'gc Mutation<'gc>,
89 receiver: Value<'gc>,
90 _args: Vec<Value<'gc>>,
91) -> Result<Value<'gc>, VmError> {
92 let s = receiver.as_string_value()?;
93 let trimmed = s.as_str().trim_start();
94 // Ok(Value::String(mc.intern(trimmed.as_bytes())))
95 Ok(Value::IoString(Gc::new(mc, trimmed.to_owned())))
96}
97
98fn trim_end<'gc>(
99 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