comrak

Struct RenderOptionsBuilder

Source
pub struct RenderOptionsBuilder<S: State = Empty> { /* private fields */ }
Expand description

Use builder syntax to set the inputs and finish with build().

Implementations§

Source§

impl<S: State> RenderOptionsBuilder<S>

Source

pub fn build(self) -> RenderOptions
where S: IsComplete,

Finish building and return the requested object

Source

pub fn hardbreaks(self, value: bool) -> RenderOptionsBuilder<SetHardbreaks<S>>
where S::Hardbreaks: IsUnset,

Optional (Some / Option setters). Default: false.

Soft line breaks in the input translate into hard line breaks in the output.

let mut options = Options::default();
assert_eq!(markdown_to_html("Hello.\nWorld.\n", &options),
           "<p>Hello.\nWorld.</p>\n");

options.render.hardbreaks = true;
assert_eq!(markdown_to_html("Hello.\nWorld.\n", &options),
           "<p>Hello.<br />\nWorld.</p>\n");
Source

pub fn maybe_hardbreaks( self, value: Option<bool>, ) -> RenderOptionsBuilder<SetHardbreaks<S>>
where S::Hardbreaks: IsUnset,

Optional (Some / Option setters). Default: false.

Soft line breaks in the input translate into hard line breaks in the output.

let mut options = Options::default();
assert_eq!(markdown_to_html("Hello.\nWorld.\n", &options),
           "<p>Hello.\nWorld.</p>\n");

options.render.hardbreaks = true;
assert_eq!(markdown_to_html("Hello.\nWorld.\n", &options),
           "<p>Hello.<br />\nWorld.</p>\n");
Source

pub fn github_pre_lang( self, value: bool, ) -> RenderOptionsBuilder<SetGithubPreLang<S>>
where S::GithubPreLang: IsUnset,

Optional (Some / Option setters). Default: false.

GitHub-style <pre lang="xyz"> is used for fenced code blocks with info tags.

let mut options = Options::default();
assert_eq!(markdown_to_html("``` rust\nfn hello();\n```\n", &options),
           "<pre><code class=\"language-rust\">fn hello();\n</code></pre>\n");

options.render.github_pre_lang = true;
assert_eq!(markdown_to_html("``` rust\nfn hello();\n```\n", &options),
           "<pre lang=\"rust\"><code>fn hello();\n</code></pre>\n");
Source

pub fn maybe_github_pre_lang( self, value: Option<bool>, ) -> RenderOptionsBuilder<SetGithubPreLang<S>>
where S::GithubPreLang: IsUnset,

Optional (Some / Option setters). Default: false.

GitHub-style <pre lang="xyz"> is used for fenced code blocks with info tags.

let mut options = Options::default();
assert_eq!(markdown_to_html("``` rust\nfn hello();\n```\n", &options),
           "<pre><code class=\"language-rust\">fn hello();\n</code></pre>\n");

options.render.github_pre_lang = true;
assert_eq!(markdown_to_html("``` rust\nfn hello();\n```\n", &options),
           "<pre lang=\"rust\"><code>fn hello();\n</code></pre>\n");
Source

pub fn full_info_string( self, value: bool, ) -> RenderOptionsBuilder<SetFullInfoString<S>>
where S::FullInfoString: IsUnset,

Optional (Some / Option setters). Default: false.

Enable full info strings for code blocks

let mut options = Options::default();
assert_eq!(markdown_to_html("``` rust extra info\nfn hello();\n```\n", &options),
           "<pre><code class=\"language-rust\">fn hello();\n</code></pre>\n");

options.render.full_info_string = true;
let html = markdown_to_html("``` rust extra info\nfn hello();\n```\n", &options);
let re = regex::Regex::new(r#"data-meta="extra info""#).unwrap();
assert!(re.is_match(&html));
Source

pub fn maybe_full_info_string( self, value: Option<bool>, ) -> RenderOptionsBuilder<SetFullInfoString<S>>
where S::FullInfoString: IsUnset,

Optional (Some / Option setters). Default: false.

Enable full info strings for code blocks

let mut options = Options::default();
assert_eq!(markdown_to_html("``` rust extra info\nfn hello();\n```\n", &options),
           "<pre><code class=\"language-rust\">fn hello();\n</code></pre>\n");

options.render.full_info_string = true;
let html = markdown_to_html("``` rust extra info\nfn hello();\n```\n", &options);
let re = regex::Regex::new(r#"data-meta="extra info""#).unwrap();
assert!(re.is_match(&html));
Source

pub fn width(self, value: usize) -> RenderOptionsBuilder<SetWidth<S>>
where S::Width: IsUnset,

Optional (Some / Option setters). Default: 0.

The wrap column when outputting CommonMark.

let mut options = Options::default();
let node = parse_document(&arena, "hello hello hello hello hello hello", &options);
let mut output = vec![];
format_commonmark(node, &options, &mut output).unwrap();
assert_eq!(String::from_utf8(output).unwrap(),
           "hello hello hello hello hello hello\n");

options.render.width = 20;
let mut output = vec![];
format_commonmark(node, &options, &mut output).unwrap();
assert_eq!(String::from_utf8(output).unwrap(),
           "hello hello hello\nhello hello hello\n");
Source

pub fn maybe_width( self, value: Option<usize>, ) -> RenderOptionsBuilder<SetWidth<S>>
where S::Width: IsUnset,

Optional (Some / Option setters). Default: 0.

The wrap column when outputting CommonMark.

let mut options = Options::default();
let node = parse_document(&arena, "hello hello hello hello hello hello", &options);
let mut output = vec![];
format_commonmark(node, &options, &mut output).unwrap();
assert_eq!(String::from_utf8(output).unwrap(),
           "hello hello hello hello hello hello\n");

options.render.width = 20;
let mut output = vec![];
format_commonmark(node, &options, &mut output).unwrap();
assert_eq!(String::from_utf8(output).unwrap(),
           "hello hello hello\nhello hello hello\n");
Source

pub fn unsafe_(self, value: bool) -> RenderOptionsBuilder<SetUnsafe<S>>
where S::Unsafe: IsUnset,

Optional (Some / Option setters). Default: false.

Allow rendering of raw HTML and potentially dangerous links.

let mut options = Options::default();
let input = "<script>\nalert('xyz');\n</script>\n\n\
             Possibly <marquee>annoying</marquee>.\n\n\
             [Dangerous](javascript:alert(document.cookie)).\n\n\
             [Safe](http://commonmark.org).\n";

assert_eq!(markdown_to_html(input, &options),
           "<!-- raw HTML omitted -->\n\
            <p>Possibly <!-- raw HTML omitted -->annoying<!-- raw HTML omitted -->.</p>\n\
            <p><a href=\"\">Dangerous</a>.</p>\n\
            <p><a href=\"http://commonmark.org\">Safe</a>.</p>\n");

options.render.unsafe_ = true;
assert_eq!(markdown_to_html(input, &options),
           "<script>\nalert(\'xyz\');\n</script>\n\
            <p>Possibly <marquee>annoying</marquee>.</p>\n\
            <p><a href=\"javascript:alert(document.cookie)\">Dangerous</a>.</p>\n\
            <p><a href=\"http://commonmark.org\">Safe</a>.</p>\n");
Source

pub fn maybe_unsafe_( self, value: Option<bool>, ) -> RenderOptionsBuilder<SetUnsafe<S>>
where S::Unsafe: IsUnset,

Optional (Some / Option setters). Default: false.

Allow rendering of raw HTML and potentially dangerous links.

let mut options = Options::default();
let input = "<script>\nalert('xyz');\n</script>\n\n\
             Possibly <marquee>annoying</marquee>.\n\n\
             [Dangerous](javascript:alert(document.cookie)).\n\n\
             [Safe](http://commonmark.org).\n";

assert_eq!(markdown_to_html(input, &options),
           "<!-- raw HTML omitted -->\n\
            <p>Possibly <!-- raw HTML omitted -->annoying<!-- raw HTML omitted -->.</p>\n\
            <p><a href=\"\">Dangerous</a>.</p>\n\
            <p><a href=\"http://commonmark.org\">Safe</a>.</p>\n");

options.render.unsafe_ = true;
assert_eq!(markdown_to_html(input, &options),
           "<script>\nalert(\'xyz\');\n</script>\n\
            <p>Possibly <marquee>annoying</marquee>.</p>\n\
            <p><a href=\"javascript:alert(document.cookie)\">Dangerous</a>.</p>\n\
            <p><a href=\"http://commonmark.org\">Safe</a>.</p>\n");
Source

pub fn escape(self, value: bool) -> RenderOptionsBuilder<SetEscape<S>>
where S::Escape: IsUnset,

Optional (Some / Option setters). Default: false.

Escape raw HTML instead of clobbering it.

let mut options = Options::default();
let input = "<i>italic text</i>";

assert_eq!(markdown_to_html(input, &options),
           "<p><!-- raw HTML omitted -->italic text<!-- raw HTML omitted --></p>\n");

options.render.escape = true;
assert_eq!(markdown_to_html(input, &options),
           "<p>&lt;i&gt;italic text&lt;/i&gt;</p>\n");
Source

pub fn maybe_escape( self, value: Option<bool>, ) -> RenderOptionsBuilder<SetEscape<S>>
where S::Escape: IsUnset,

Optional (Some / Option setters). Default: false.

Escape raw HTML instead of clobbering it.

let mut options = Options::default();
let input = "<i>italic text</i>";

assert_eq!(markdown_to_html(input, &options),
           "<p><!-- raw HTML omitted -->italic text<!-- raw HTML omitted --></p>\n");

options.render.escape = true;
assert_eq!(markdown_to_html(input, &options),
           "<p>&lt;i&gt;italic text&lt;/i&gt;</p>\n");
Source

pub fn list_style( self, value: ListStyleType, ) -> RenderOptionsBuilder<SetListStyle<S>>
where S::ListStyle: IsUnset,

Optional (Some / Option setters). Default: <ListStyleType as Default>::default().

Set the type of bullet list marker to use. Options are:

let mut options = Options::default();
let input = "- one\n- two\n- three";
assert_eq!(markdown_to_commonmark(input, &options),
           "- one\n- two\n- three\n"); // default is Dash

options.render.list_style = ListStyleType::Plus;
assert_eq!(markdown_to_commonmark(input, &options),
           "+ one\n+ two\n+ three\n");

options.render.list_style = ListStyleType::Star;
assert_eq!(markdown_to_commonmark(input, &options),
           "* one\n* two\n* three\n");
Source

pub fn maybe_list_style( self, value: Option<ListStyleType>, ) -> RenderOptionsBuilder<SetListStyle<S>>
where S::ListStyle: IsUnset,

Optional (Some / Option setters). Default: <ListStyleType as Default>::default().

Set the type of bullet list marker to use. Options are:

let mut options = Options::default();
let input = "- one\n- two\n- three";
assert_eq!(markdown_to_commonmark(input, &options),
           "- one\n- two\n- three\n"); // default is Dash

options.render.list_style = ListStyleType::Plus;
assert_eq!(markdown_to_commonmark(input, &options),
           "+ one\n+ two\n+ three\n");

options.render.list_style = ListStyleType::Star;
assert_eq!(markdown_to_commonmark(input, &options),
           "* one\n* two\n* three\n");
Source

pub fn sourcepos(self, value: bool) -> RenderOptionsBuilder<SetSourcepos<S>>
where S::Sourcepos: IsUnset,

Optional (Some / Option setters). Default: false.

Include source position attributes in HTML and XML output.

Sourcepos information is reliable for all core block items, and most extensions. The description lists extension still has issues; see https://github.com/kivikakk/comrak/blob/3bb6d4ce/src/tests/description_lists.rs#L60-L125.

Sourcepos information is not reliable for inlines, and is not included in HTML without also setting [experimental_inline_sourcepos]. See https://github.com/kivikakk/comrak/pull/439 for a discussion.

let mut options = Options::default();
options.render.sourcepos = true;
let input = "## Hello world!";
let xml = markdown_to_commonmark_xml(input, &options);
assert!(xml.contains("<text sourcepos=\"1:4-1:15\" xml:space=\"preserve\">"));
Source

pub fn maybe_sourcepos( self, value: Option<bool>, ) -> RenderOptionsBuilder<SetSourcepos<S>>
where S::Sourcepos: IsUnset,

Optional (Some / Option setters). Default: false.

Include source position attributes in HTML and XML output.

Sourcepos information is reliable for all core block items, and most extensions. The description lists extension still has issues; see https://github.com/kivikakk/comrak/blob/3bb6d4ce/src/tests/description_lists.rs#L60-L125.

Sourcepos information is not reliable for inlines, and is not included in HTML without also setting [experimental_inline_sourcepos]. See https://github.com/kivikakk/comrak/pull/439 for a discussion.

let mut options = Options::default();
options.render.sourcepos = true;
let input = "## Hello world!";
let xml = markdown_to_commonmark_xml(input, &options);
assert!(xml.contains("<text sourcepos=\"1:4-1:15\" xml:space=\"preserve\">"));
Source

pub fn experimental_inline_sourcepos( self, value: bool, ) -> RenderOptionsBuilder<SetExperimentalInlineSourcepos<S>>
where S::ExperimentalInlineSourcepos: IsUnset,

Optional (Some / Option setters). Default: false.

Include inline sourcepos in HTML output, which is known to have issues. See https://github.com/kivikakk/comrak/pull/439 for a discussion.

let mut options = Options::default();
options.render.sourcepos = true;
let input = "Hello *world*!";
assert_eq!(markdown_to_html(input, &options),
           "<p data-sourcepos=\"1:1-1:14\">Hello <em>world</em>!</p>\n");
options.render.experimental_inline_sourcepos = true;
assert_eq!(markdown_to_html(input, &options),
           "<p data-sourcepos=\"1:1-1:14\">Hello <em data-sourcepos=\"1:7-1:13\">world</em>!</p>\n");
Source

pub fn maybe_experimental_inline_sourcepos( self, value: Option<bool>, ) -> RenderOptionsBuilder<SetExperimentalInlineSourcepos<S>>
where S::ExperimentalInlineSourcepos: IsUnset,

Optional (Some / Option setters). Default: false.

Include inline sourcepos in HTML output, which is known to have issues. See https://github.com/kivikakk/comrak/pull/439 for a discussion.

let mut options = Options::default();
options.render.sourcepos = true;
let input = "Hello *world*!";
assert_eq!(markdown_to_html(input, &options),
           "<p data-sourcepos=\"1:1-1:14\">Hello <em>world</em>!</p>\n");
options.render.experimental_inline_sourcepos = true;
assert_eq!(markdown_to_html(input, &options),
           "<p data-sourcepos=\"1:1-1:14\">Hello <em data-sourcepos=\"1:7-1:13\">world</em>!</p>\n");
Source

pub fn escaped_char_spans( self, value: bool, ) -> RenderOptionsBuilder<SetEscapedCharSpans<S>>
where S::EscapedCharSpans: IsUnset,

Optional (Some / Option setters). Default: false.

Wrap escaped characters in a <span> to allow any post-processing to recognize them.

let mut options = Options::default();
let input = "Notify user \\@example";

assert_eq!(markdown_to_html(input, &options),
           "<p>Notify user @example</p>\n");

options.render.escaped_char_spans = true;
assert_eq!(markdown_to_html(input, &options),
           "<p>Notify user <span data-escaped-char>@</span>example</p>\n");
Source

pub fn maybe_escaped_char_spans( self, value: Option<bool>, ) -> RenderOptionsBuilder<SetEscapedCharSpans<S>>
where S::EscapedCharSpans: IsUnset,

Optional (Some / Option setters). Default: false.

Wrap escaped characters in a <span> to allow any post-processing to recognize them.

let mut options = Options::default();
let input = "Notify user \\@example";

assert_eq!(markdown_to_html(input, &options),
           "<p>Notify user @example</p>\n");

options.render.escaped_char_spans = true;
assert_eq!(markdown_to_html(input, &options),
           "<p>Notify user <span data-escaped-char>@</span>example</p>\n");
Source

pub fn ignore_setext( self, value: bool, ) -> RenderOptionsBuilder<SetIgnoreSetext<S>>
where S::IgnoreSetext: IsUnset,

Optional (Some / Option setters). Default: false.

Ignore setext headings in input.

let mut options = Options::default();
let input = "setext heading\n---";

assert_eq!(markdown_to_html(input, &options),
           "<h2>setext heading</h2>\n");

options.render.ignore_setext = true;
assert_eq!(markdown_to_html(input, &options),
           "<p>setext heading</p>\n<hr />\n");
Source

pub fn maybe_ignore_setext( self, value: Option<bool>, ) -> RenderOptionsBuilder<SetIgnoreSetext<S>>
where S::IgnoreSetext: IsUnset,

Optional (Some / Option setters). Default: false.

Ignore setext headings in input.

let mut options = Options::default();
let input = "setext heading\n---";

assert_eq!(markdown_to_html(input, &options),
           "<h2>setext heading</h2>\n");

options.render.ignore_setext = true;
assert_eq!(markdown_to_html(input, &options),
           "<p>setext heading</p>\n<hr />\n");

Optional (Some / Option setters). Default: false.

Ignore empty links in input.

let mut options = Options::default();
let input = "[]()";

assert_eq!(markdown_to_html(input, &options),
           "<p><a href=\"\"></a></p>\n");

options.render.ignore_empty_links = true;
assert_eq!(markdown_to_html(input, &options), "<p>[]()</p>\n");

Optional (Some / Option setters). Default: false.

Ignore empty links in input.

let mut options = Options::default();
let input = "[]()";

assert_eq!(markdown_to_html(input, &options),
           "<p><a href=\"\"></a></p>\n");

options.render.ignore_empty_links = true;
assert_eq!(markdown_to_html(input, &options), "<p>[]()</p>\n");
Source

pub fn gfm_quirks(self, value: bool) -> RenderOptionsBuilder<SetGfmQuirks<S>>
where S::GfmQuirks: IsUnset,

Optional (Some / Option setters). Default: false.

Enables GFM quirks in HTML output which break CommonMark compatibility.

let mut options = Options::default();
let input = "****abcd**** *_foo_*";

assert_eq!(markdown_to_html(input, &options),
           "<p><strong><strong>abcd</strong></strong> <em><em>foo</em></em></p>\n");

options.render.gfm_quirks = true;
assert_eq!(markdown_to_html(input, &options),
           "<p><strong>abcd</strong> <em><em>foo</em></em></p>\n");
Source

pub fn maybe_gfm_quirks( self, value: Option<bool>, ) -> RenderOptionsBuilder<SetGfmQuirks<S>>
where S::GfmQuirks: IsUnset,

Optional (Some / Option setters). Default: false.

Enables GFM quirks in HTML output which break CommonMark compatibility.

let mut options = Options::default();
let input = "****abcd**** *_foo_*";

assert_eq!(markdown_to_html(input, &options),
           "<p><strong><strong>abcd</strong></strong> <em><em>foo</em></em></p>\n");

options.render.gfm_quirks = true;
assert_eq!(markdown_to_html(input, &options),
           "<p><strong>abcd</strong> <em><em>foo</em></em></p>\n");
Source

pub fn prefer_fenced( self, value: bool, ) -> RenderOptionsBuilder<SetPreferFenced<S>>
where S::PreferFenced: IsUnset,

Optional (Some / Option setters). Default: false.

Prefer fenced code blocks when outputting CommonMark.

let arena = Arena::new();
let mut options = Options::default();
let input = "```\nhello\n```\n";
let root = parse_document(&arena, input, &options);

let mut buf = Vec::new();
format_commonmark(&root, &options, &mut buf);
assert_eq!(str::from_utf8(&buf).unwrap(), "    hello\n");

buf.clear();
options.render.prefer_fenced = true;
format_commonmark(&root, &options, &mut buf);
assert_eq!(str::from_utf8(&buf).unwrap(), "```\nhello\n```\n");
Source

pub fn maybe_prefer_fenced( self, value: Option<bool>, ) -> RenderOptionsBuilder<SetPreferFenced<S>>
where S::PreferFenced: IsUnset,

Optional (Some / Option setters). Default: false.

Prefer fenced code blocks when outputting CommonMark.

let arena = Arena::new();
let mut options = Options::default();
let input = "```\nhello\n```\n";
let root = parse_document(&arena, input, &options);

let mut buf = Vec::new();
format_commonmark(&root, &options, &mut buf);
assert_eq!(str::from_utf8(&buf).unwrap(), "    hello\n");

buf.clear();
options.render.prefer_fenced = true;
format_commonmark(&root, &options, &mut buf);
assert_eq!(str::from_utf8(&buf).unwrap(), "```\nhello\n```\n");
Source

pub fn figure_with_caption( self, value: bool, ) -> RenderOptionsBuilder<SetFigureWithCaption<S>>
where S::FigureWithCaption: IsUnset,

Optional (Some / Option setters). Default: false.

Render the image as a figure element with the title as its caption.

let mut options = Options::default();
let input = "![image](https://example.com/image.png \"this is an image\")";

assert_eq!(markdown_to_html(input, &options),
           "<p><img src=\"https://example.com/image.png\" alt=\"image\" title=\"this is an image\" /></p>\n");

options.render.figure_with_caption = true;
assert_eq!(markdown_to_html(input, &options),
           "<p><figure><img src=\"https://example.com/image.png\" alt=\"image\" title=\"this is an image\" /><figcaption>this is an image</figcaption></figure></p>\n");
Source

pub fn maybe_figure_with_caption( self, value: Option<bool>, ) -> RenderOptionsBuilder<SetFigureWithCaption<S>>
where S::FigureWithCaption: IsUnset,

Optional (Some / Option setters). Default: false.

Render the image as a figure element with the title as its caption.

let mut options = Options::default();
let input = "![image](https://example.com/image.png \"this is an image\")";

assert_eq!(markdown_to_html(input, &options),
           "<p><img src=\"https://example.com/image.png\" alt=\"image\" title=\"this is an image\" /></p>\n");

options.render.figure_with_caption = true;
assert_eq!(markdown_to_html(input, &options),
           "<p><figure><img src=\"https://example.com/image.png\" alt=\"image\" title=\"this is an image\" /><figcaption>this is an image</figcaption></figure></p>\n");
Source

pub fn tasklist_classes( self, value: bool, ) -> RenderOptionsBuilder<SetTasklistClasses<S>>
where S::TasklistClasses: IsUnset,

Optional (Some / Option setters). Default: false.

Add classes to the output of the tasklist extension. This allows tasklists to be styled.

let mut options = Options::default();
options.extension.tasklist = true;
let input = "- [ ] Foo";

assert_eq!(markdown_to_html(input, &options),
           "<ul>\n<li><input type=\"checkbox\" disabled=\"\" /> Foo</li>\n</ul>\n");

options.render.tasklist_classes = true;
assert_eq!(markdown_to_html(input, &options),
           "<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" class=\"task-list-item-checkbox\" disabled=\"\" /> Foo</li>\n</ul>\n");
Source

pub fn maybe_tasklist_classes( self, value: Option<bool>, ) -> RenderOptionsBuilder<SetTasklistClasses<S>>
where S::TasklistClasses: IsUnset,

Optional (Some / Option setters). Default: false.

Add classes to the output of the tasklist extension. This allows tasklists to be styled.

let mut options = Options::default();
options.extension.tasklist = true;
let input = "- [ ] Foo";

assert_eq!(markdown_to_html(input, &options),
           "<ul>\n<li><input type=\"checkbox\" disabled=\"\" /> Foo</li>\n</ul>\n");

options.render.tasklist_classes = true;
assert_eq!(markdown_to_html(input, &options),
           "<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" class=\"task-list-item-checkbox\" disabled=\"\" /> Foo</li>\n</ul>\n");
Source

pub fn ol_width(self, value: usize) -> RenderOptionsBuilder<SetOlWidth<S>>
where S::OlWidth: IsUnset,

Optional (Some / Option setters). Default: 0.

Render ordered list with a minimum marker width. Having a width lower than 3 doesn’t do anything.

let mut options = Options::default();
let input = "1. Something";

assert_eq!(markdown_to_commonmark(input, &options),
           "1. Something\n");

options.render.ol_width = 5;
assert_eq!(markdown_to_commonmark(input, &options),
           "1.   Something\n");
Source

pub fn maybe_ol_width( self, value: Option<usize>, ) -> RenderOptionsBuilder<SetOlWidth<S>>
where S::OlWidth: IsUnset,

Optional (Some / Option setters). Default: 0.

Render ordered list with a minimum marker width. Having a width lower than 3 doesn’t do anything.

let mut options = Options::default();
let input = "1. Something";

assert_eq!(markdown_to_commonmark(input, &options),
           "1. Something\n");

options.render.ol_width = 5;
assert_eq!(markdown_to_commonmark(input, &options),
           "1.   Something\n");

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.