pub struct TestCrateBuilder<'a> { /* private fields */ }Expand description
A builder for creating test crates with a fluent API.
§Example
ⓘ
// Minimal usage with defaults
TestCrateBuilder::new(test_db)
.name("mycrate")
.build()
.await
.unwrap();
// Full customization
let crate_id = TestCrateBuilder::new(test_db)
.name("mycrate")
.owner("testuser")
.version("2.0.0")
.created(Utc::now())
.downloads(100)
.build()
.await
.unwrap();Implementations§
Source§impl<'a> TestCrateBuilder<'a>
impl<'a> TestCrateBuilder<'a>
Sourcepub fn new(db: &'a Database) -> Self
pub fn new(db: &'a Database) -> Self
Create a new builder with default values.
Defaults:
owner: “admin”version: “1.0.0”created:default_created()downloads: None (0)
Sourcepub fn created(self, created: DateTime<Utc>) -> Self
pub fn created(self, created: DateTime<Utc>) -> Self
Set the creation date. Defaults to default_created().
Auto Trait Implementations§
impl<'a> Freeze for TestCrateBuilder<'a>
impl<'a> !RefUnwindSafe for TestCrateBuilder<'a>
impl<'a> Send for TestCrateBuilder<'a>
impl<'a> Sync for TestCrateBuilder<'a>
impl<'a> Unpin for TestCrateBuilder<'a>
impl<'a> UnsafeUnpin for TestCrateBuilder<'a>
impl<'a> !UnwindSafe for TestCrateBuilder<'a>
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 more