summaryrefslogtreecommitdiff
path: root/library/src/base/string.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-24 17:39:08 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-24 17:41:41 +0100
commit8d3c68a1deb28dce2b80ed61f85141180ce6a951 (patch)
treede007203d448d6b6a2df7838e802f85d23ccd1a6 /library/src/base/string.rs
parent5ae81971f299688b05d77af208d7bb44ffce5e2d (diff)
Protect Vm
Diffstat (limited to 'library/src/base/string.rs')
-rw-r--r--library/src/base/string.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/library/src/base/string.rs b/library/src/base/string.rs
index ed444d35..058ee248 100644
--- a/library/src/base/string.rs
+++ b/library/src/base/string.rs
@@ -3,12 +3,12 @@ use typst::model::Regex;
use crate::prelude::*;
/// The string representation of a value.
-pub fn repr(_: &mut Vm, args: &mut Args) -> SourceResult<Value> {
+pub fn repr(_: &Vm, args: &mut Args) -> SourceResult<Value> {
Ok(args.expect::<Value>("value")?.repr().into())
}
/// Convert a value to a string.
-pub fn str(_: &mut Vm, args: &mut Args) -> SourceResult<Value> {
+pub fn str(_: &Vm, args: &mut Args) -> SourceResult<Value> {
let Spanned { v, span } = args.expect("value")?;
Ok(Value::Str(match v {
Value::Int(v) => format_str!("{}", v),
@@ -19,29 +19,29 @@ pub fn str(_: &mut Vm, args: &mut Args) -> SourceResult<Value> {
}
/// Create blind text.
-pub fn lorem(_: &mut Vm, args: &mut Args) -> SourceResult<Value> {
+pub fn lorem(_: &Vm, args: &mut Args) -> SourceResult<Value> {
let words: usize = args.expect("number of words")?;
Ok(Value::Str(lipsum::lipsum(words).into()))
}
/// Create a regular expression.
-pub fn regex(_: &mut Vm, args: &mut Args) -> SourceResult<Value> {
+pub fn regex(_: &Vm, args: &mut Args) -> SourceResult<Value> {
let Spanned { v, span } = args.expect::<Spanned<EcoString>>("regular expression")?;
Ok(Regex::new(&v).at(span)?.into())
}
/// Converts an integer into one or multiple letters.
-pub fn letter(_: &mut Vm, args: &mut Args) -> SourceResult<Value> {
+pub fn letter(_: &Vm, args: &mut Args) -> SourceResult<Value> {
numbered(Numbering::Letter, args)
}
/// Converts an integer into a roman numeral.
-pub fn roman(_: &mut Vm, args: &mut Args) -> SourceResult<Value> {
+pub fn roman(_: &Vm, args: &mut Args) -> SourceResult<Value> {
numbered(Numbering::Roman, args)
}
/// Convert a number into a symbol.
-pub fn symbol(_: &mut Vm, args: &mut Args) -> SourceResult<Value> {
+pub fn symbol(_: &Vm, args: &mut Args) -> SourceResult<Value> {
numbered(Numbering::Symbol, args)
}