Skip to content

Commit

Permalink
Added documentation to public functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ArvinSKushwaha authored and kivikakk committed Oct 2, 2022
1 parent 551d1cb commit fe4ca0b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/plugins/syntect.rs
Expand Up @@ -119,21 +119,33 @@ pub struct SyntectAdapterBuilder<'a> {
}

impl<'a> SyntectAdapterBuilder<'a> {
/// Creates a new empty [`SyntectAdapterBuilder`]
pub fn new() -> Self {
Default::default()
}

/// Sets the theme
pub fn theme(mut self, s: &'a str) -> Self {
self.theme.replace(s);
self
}

/// Sets the syntax set
pub fn syntax_set(mut self, s: SyntaxSet) -> Self {
self.syntax_set.replace(s);
self
}

/// Sets the theme set
pub fn theme_set(mut self, s: ThemeSet) -> Self {
self.theme_set.replace(s);
self
}

/// Builds the [`SyntectAdapter`]. Default values:
/// - `theme`: `InspiredGitHub`
/// - `syntax_set`: [`SyntaxSet::load_defaults_newlines()`]
/// - `theme_set`: [`ThemeSet::load_defaults()`]
pub fn build(self) -> SyntectAdapter<'a> {
SyntectAdapter {
theme: self.theme.unwrap_or("InspiredGitHub"),
Expand Down

0 comments on commit fe4ca0b

Please sign in to comment.