Struct Config Copy item path Source pub struct Config {
pub crate_name: String ,
pub item_path: Option <String >,
pub online: bool ,
}
Expand description Configuration options for fetching Rust documentation.
The name of the crate to fetch documentation for.
Optional path to a specific item within the crate.
Whether to fetch documentation from docs.rs instead of building locally.
Create a new configuration with the specified crate name.
§ Arguments
crate_name
- The name of the crate to fetch documentation for
§ Examples
use rustdoc_text::Config;
let config = Config::new("serde" );
assert_eq! (config.crate_name, "serde" );
assert_eq! (config.online, false );
Set the item path for the configuration.
§ Arguments
item_path
- The item path within the crate
§ Examples
use rustdoc_text::Config;
let config = Config::new("serde" ).with_item_path("Deserializer" );
assert_eq! (config.item_path, Some ("Deserializer" .to_string()));
Set whether to fetch documentation from docs.rs.
§ Arguments
online
- Whether to fetch documentation from docs.rs
§ Examples
use rustdoc_text::Config;
let config = Config::new("serde" ).with_online(true );
assert_eq! (config.online, true );
Execute the configuration to fetch documentation.
§ Returns
The documentation as Markdown text.
§ Examples
use rustdoc_text::Config;
let docs = Config::new("serde" )
.with_online(true )
.with_item_path("Deserializer" )
.execute()? ;
println! ("{}" , docs);
Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more Returns the argument unchanged.
Instruments this type with the provided
Span
, returning an
Instrumented
wrapper.
Read more Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From <T> for U
chooses to do.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.