Try to get rid of owned types

Inspired by https://www.youtube.com/watch?v=A4cKi7PTJSs. This turns a
lot of cloning Strings and PathBufs into Rcs.
This commit is contained in:
Adrian Heine 2023-06-17 14:53:38 +02:00
parent e3b425eb1c
commit d091265d27
20 changed files with 343 additions and 232 deletions

View file

@ -3,7 +3,7 @@ use schematics::symbols::file::File as FileSymbol;
use schematics::symbols::Symbol;
use std::fs::File;
use std::io::Write;
use std::path::{Path, PathBuf};
use std::path::Path;
use tempfile::{tempdir, TempDir};
fn get_dir(content: Option<&str>) -> TempDir {
@ -19,8 +19,8 @@ fn get_dir(content: Option<&str>) -> TempDir {
tmp_dir
}
fn get_symbol(path: &Path) -> FileSymbol<PathBuf, &str> {
FileSymbol::new(path.join("filename"), "target content")
fn get_symbol(path: &Path) -> FileSymbol<Box<Path>, &str> {
FileSymbol::new(path.join("filename").into(), "target content")
}
// Normal cases