From 5b751e3c7ae2ac57063c9aed7443e369a18823a4 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 16 Mar 2025 15:53:24 +0200 Subject: [PATCH] change result data type to `&str` --- src/line/header.rs | 4 ++-- src/line/list.rs | 6 +++--- src/line/quote.rs | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/line/header.rs b/src/line/header.rs index 061ce34..c2f8647 100644 --- a/src/line/header.rs +++ b/src/line/header.rs @@ -37,7 +37,7 @@ impl Header { } pub trait Gemtext { - /// Get [Gemtext](https://geminiprotocol.net/docs/gemtext-specification.gmi) value from `Self` + /// Get [Gemtext](https://geminiprotocol.net/docs/gemtext-specification.gmi) value for `Self` fn as_value(&self) -> Option<&Self>; /// Convert `Self` to `Level` fn to_level(&self) -> Option; @@ -46,7 +46,7 @@ pub trait Gemtext { } impl Gemtext for str { - fn as_value(&self) -> Option<&Self> { + fn as_value(&self) -> Option<&str> { if let Some(h3) = self.strip_prefix(TAG_H3) { if h3.trim_start().starts_with(TAG_H1) { return None; // H4+ diff --git a/src/line/list.rs b/src/line/list.rs index b3ea5e9..0b6e966 100644 --- a/src/line/list.rs +++ b/src/line/list.rs @@ -25,14 +25,14 @@ impl List { } pub trait Gemtext { - /// Get [Gemtext](https://geminiprotocol.net/docs/gemtext-specification.gmi) value from `Self` - fn as_value(&self) -> Option<&Self>; + /// Get [Gemtext](https://geminiprotocol.net/docs/gemtext-specification.gmi) value for `Self` + fn as_value(&self) -> Option<&str>; /// Convert `Self` to [Gemtext](https://geminiprotocol.net/docs/gemtext-specification.gmi) line fn to_source(&self) -> String; } impl Gemtext for str { - fn as_value(&self) -> Option<&Self> { + fn as_value(&self) -> Option<&str> { self.strip_prefix(TAG).map(|s| s.trim()) } fn to_source(&self) -> String { diff --git a/src/line/quote.rs b/src/line/quote.rs index 5ac1fb2..dbfb3fe 100644 --- a/src/line/quote.rs +++ b/src/line/quote.rs @@ -25,14 +25,14 @@ impl Quote { } pub trait Gemtext { - /// Get [Gemtext](https://geminiprotocol.net/docs/gemtext-specification.gmi) value from `Self` - fn as_value(&self) -> Option<&Self>; + /// Get [Gemtext](https://geminiprotocol.net/docs/gemtext-specification.gmi) value for `Self` + fn as_value(&self) -> Option<&str>; /// Convert `Self` to [Gemtext](https://geminiprotocol.net/docs/gemtext-specification.gmi) line fn to_source(&self) -> String; } impl Gemtext for str { - fn as_value(&self) -> Option<&Self> { + fn as_value(&self) -> Option<&str> { self.strip_prefix(TAG).map(|s| s.trim()) } fn to_source(&self) -> String {