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

@ -5,7 +5,7 @@ use std::path::Path;
#[derive(Clone, Debug, PartialEq, Hash, Eq)]
pub struct FpmPoolConfig {
max_children: NonZeroUsize,
custom: Option<String>,
custom: Option<Box<str>>,
}
impl Display for FpmPoolConfig {
@ -27,7 +27,7 @@ impl From<usize> for FpmPoolConfig {
}
impl FpmPoolConfig {
pub fn new(max_children: NonZeroUsize, custom: impl Into<String>) -> Self {
pub fn new(max_children: NonZeroUsize, custom: impl Into<Box<str>>) -> Self {
Self {
max_children,
custom: Some(custom.into()),