Doc strings

This commit is contained in:
Wojciech Kozlowski 2023-04-12 18:31:21 +02:00
parent f8b5680dc0
commit 0899a45587
3 changed files with 8 additions and 8 deletions

View File

@ -28,7 +28,7 @@ pub struct JsonDatabase {
} }
impl JsonDatabase { impl JsonDatabase {
/// Create a new JSON database with the provided backend, e.g. [JsonDatabaseFileBackend]. /// Create a new JSON database with the provided backend, e.g. [`JsonDatabaseFileBackend`].
pub fn new(backend: Box<dyn JsonDatabaseBackend + Send + Sync>) -> Self { pub fn new(backend: Box<dyn JsonDatabaseBackend + Send + Sync>) -> Self {
JsonDatabase { backend } JsonDatabase { backend }
} }
@ -58,7 +58,7 @@ pub struct JsonDatabaseFileBackend {
} }
impl JsonDatabaseFileBackend { impl JsonDatabaseFileBackend {
/// Create a [JsonDatabaseFileBackend] that will read/write to the provided path. /// Create a [`JsonDatabaseFileBackend`] that will read/write to the provided path.
pub fn new(path: &Path) -> Self { pub fn new(path: &Path) -> Self {
JsonDatabaseFileBackend { JsonDatabaseFileBackend {
path: path.to_path_buf(), path: path.to_path_buf(),

View File

@ -106,7 +106,7 @@ trait LibraryPrivate {
} }
impl BeetsLibrary { impl BeetsLibrary {
/// Create a new beets library with the provided executor, e.g. [BeetsLibraryCommandExecutor]. /// Create a new beets library with the provided executor, e.g. [`BeetsLibraryCommandExecutor`].
pub fn new(executor: Box<dyn BeetsLibraryExecutor + Send + Sync>) -> BeetsLibrary { pub fn new(executor: Box<dyn BeetsLibraryExecutor + Send + Sync>) -> BeetsLibrary {
BeetsLibrary { executor } BeetsLibrary { executor }
} }
@ -243,7 +243,7 @@ pub struct BeetsLibraryCommandExecutor {
} }
impl BeetsLibraryCommandExecutor { impl BeetsLibraryCommandExecutor {
/// Create a new [BeetsLibraryCommandExecutor] that uses the provided beets executable. /// Create a new [`BeetsLibraryCommandExecutor`] that uses the provided beets executable.
pub fn new(bin: &str) -> Self { pub fn new(bin: &str) -> Self {
BeetsLibraryCommandExecutor { BeetsLibraryCommandExecutor {
bin: bin.to_string(), bin: bin.to_string(),
@ -259,7 +259,7 @@ impl BeetsLibraryCommandExecutor {
} }
impl Default for BeetsLibraryCommandExecutor { impl Default for BeetsLibraryCommandExecutor {
/// Create a new [BeetsLibraryCommandExecutor] that uses the system's default beets executable. /// Create a new [`BeetsLibraryCommandExecutor`] that uses the system's default beets executable.
fn default() -> Self { fn default() -> Self {
BeetsLibraryCommandExecutor::new("beet") BeetsLibraryCommandExecutor::new("beet")
} }

View File

@ -17,19 +17,19 @@ pub enum QueryOption<T> {
} }
impl<T> QueryOption<T> { impl<T> QueryOption<T> {
/// Return `true` if [QueryOption] is not [QueryOption::None]. /// Return `true` if [`QueryOption`] is not [`QueryOption::None`].
pub fn is_some(&self) -> bool { pub fn is_some(&self) -> bool {
!matches!(self, QueryOption::None) !matches!(self, QueryOption::None)
} }
/// Return `true` if [QueryOption] is [QueryOption::None]. /// Return `true` if [`QueryOption`] is [`QueryOption::None`].
pub fn is_none(&self) -> bool { pub fn is_none(&self) -> bool {
matches!(self, QueryOption::None) matches!(self, QueryOption::None)
} }
} }
impl<T> Default for QueryOption<T> { impl<T> Default for QueryOption<T> {
/// Create a [QueryOption::None] for type `T`. /// Create a [`QueryOption::None`] for type `T`.
fn default() -> Self { fn default() -> Self {
Self::None Self::None
} }