pub(crate) struct DocTestBuilder {
pub(crate) supports_color: bool,
pub(crate) already_has_extern_crate: bool,
pub(crate) has_main_fn: bool,
pub(crate) crate_attrs: String,
pub(crate) maybe_crate_attrs: String,
pub(crate) crates: String,
pub(crate) everything_else: String,
pub(crate) test_id: Option<String>,
pub(crate) failed_ast: bool,
pub(crate) can_be_merged: bool,
}
Expand description
This struct contains information about the doctest itself which is then used to generate doctest source code appropriately.
Fields§
§supports_color: bool
§already_has_extern_crate: bool
§has_main_fn: bool
§crate_attrs: String
§maybe_crate_attrs: String
If this is a merged doctest, it will be put into everything_else
, otherwise it will
put into crate_attrs
.
crates: String
§everything_else: String
§test_id: Option<String>
§failed_ast: bool
§can_be_merged: bool
Implementations§
Source§impl DocTestBuilder
impl DocTestBuilder
pub(crate) fn new( source: &str, crate_name: Option<&str>, edition: Edition, can_merge_doctests: bool, test_id: Option<String>, lang_str: Option<&LangString>, ) -> Self
Sourcepub(crate) fn generate_unique_doctest(
&self,
test_code: &str,
dont_insert_main: bool,
opts: &GlobalTestOptions,
crate_name: Option<&str>,
) -> (String, usize)
pub(crate) fn generate_unique_doctest( &self, test_code: &str, dont_insert_main: bool, opts: &GlobalTestOptions, crate_name: Option<&str>, ) -> (String, usize)
Transforms a test into code that can be compiled into a Rust binary, and returns the number of lines before the test code begins.
Auto Trait Implementations§
impl Freeze for DocTestBuilder
impl RefUnwindSafe for DocTestBuilder
impl Send for DocTestBuilder
impl Sync for DocTestBuilder
impl Unpin for DocTestBuilder
impl UnwindSafe for DocTestBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 128 bytes