From 915c5c0a6dbd4bab62aec567cee3929df8bc6088 Mon Sep 17 00:00:00 2001 From: Artemy Egorov Date: Wed, 7 Aug 2024 15:23:18 +0300 Subject: [PATCH] fix: type in resolve title --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/traits/resolve_title.rs | 8 ++++---- src/typed.rs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c51b0cc..bacd01c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -151,7 +151,7 @@ dependencies = [ [[package]] name = "dalet" -version = "1.0.0-pre.13" +version = "1.0.0-pre.14" dependencies = [ "bincode", "clap", diff --git a/Cargo.toml b/Cargo.toml index ad01074..6de4374 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dalet" -version = "1.0.0-pre.13" +version = "1.0.0-pre.14" edition = "2021" authors = ["artegoser"] license = "MIT" diff --git a/src/traits/resolve_title.rs b/src/traits/resolve_title.rs index a4093f7..b3d6dc5 100644 --- a/src/traits/resolve_title.rs +++ b/src/traits/resolve_title.rs @@ -4,23 +4,23 @@ use crate::typed::{ }; impl ResolveTitle for Page { - fn resolve_title(&self) -> Option<&String> { + fn resolve_title(&self) -> Option { resolve_from_tags(&self.data) } } -fn resolve_from_tags(tags: &Vec) -> Option<&String> { +fn resolve_from_tags(tags: &Vec) -> Option { for tag in tags { match tag { H(title, level) => { if *level == Hl::One { - return Some(title); + return Some(title.to_owned()); } } Meta(body, key) => { if key == "title" { - return Some(body); + return Some(body.to_owned()); } } diff --git a/src/typed.rs b/src/typed.rs index d03732d..0f01219 100644 --- a/src/typed.rs +++ b/src/typed.rs @@ -109,5 +109,5 @@ pub enum Hl { } pub trait ResolveTitle { - fn resolve_title(&self) -> Option<&String>; + fn resolve_title(&self) -> Option; }