diff options
Diffstat (limited to 'src/gen/rust/snippets.rs')
-rw-r--r-- | src/gen/rust/snippets.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gen/rust/snippets.rs b/src/gen/rust/snippets.rs new file mode 100644 index 0000000..c10c4a9 --- /dev/null +++ b/src/gen/rust/snippets.rs @@ -0,0 +1,10 @@ +pub(crate) const EXPR_NONE: &str = "::std::option::Option::None"; +pub(crate) const EXPR_VEC_NEW: &str = "::std::vec::Vec::new()"; + +fn expr_vec_with_capacity(capacity: &str) -> String { + format!("::std::vec::Vec::with_capacity({})", capacity) +} + +pub(crate) fn expr_vec_with_capacity_const(capacity: usize) -> String { + expr_vec_with_capacity(&capacity.to_string()) +} |