pub struct UserAPI { /* private fields */ }Expand description
用户API接口
Implementations§
Source§impl UserAPI
impl UserAPI
Sourcepub fn register_generator<G>(&mut self, generator: G) -> Result<()>where
G: CustomGenerator + 'static,
pub fn register_generator<G>(&mut self, generator: G) -> Result<()>where
G: CustomGenerator + 'static,
注册自定义生成器
Sourcepub fn generate(
&self,
generator_name: &str,
params: Option<&HashMap<String, Value>>,
) -> Result<Value>
pub fn generate( &self, generator_name: &str, params: Option<&HashMap<String, Value>>, ) -> Result<Value>
生成数据
Sourcepub fn generate_batch(
&self,
generator_name: &str,
count: usize,
params: Option<&HashMap<String, Value>>,
) -> Result<Vec<Value>>
pub fn generate_batch( &self, generator_name: &str, count: usize, params: Option<&HashMap<String, Value>>, ) -> Result<Vec<Value>>
批量生成数据
Sourcepub fn generate_from_template(
&self,
template_name: &str,
params: Option<&HashMap<String, Value>>,
) -> Result<Value>
pub fn generate_from_template( &self, template_name: &str, params: Option<&HashMap<String, Value>>, ) -> Result<Value>
使用模板生成数据
Sourcepub fn generate_batch_from_template(
&self,
template_name: &str,
count: usize,
params: Option<&HashMap<String, Value>>,
) -> Result<Vec<Value>>
pub fn generate_batch_from_template( &self, template_name: &str, count: usize, params: Option<&HashMap<String, Value>>, ) -> Result<Vec<Value>>
批量使用模板生成数据
Sourcepub fn list_generators(&self) -> Vec<GeneratorInfo>
pub fn list_generators(&self) -> Vec<GeneratorInfo>
列出所有生成器
Sourcepub fn list_templates(&self) -> Vec<String>
pub fn list_templates(&self) -> Vec<String>
列出所有模板
Sourcepub fn get_template(&self, name: &str) -> Option<&Template>
pub fn get_template(&self, name: &str) -> Option<&Template>
获取模板信息
Sourcepub fn remove_template(&mut self, name: &str) -> bool
pub fn remove_template(&mut self, name: &str) -> bool
删除模板
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UserAPI
impl !RefUnwindSafe for UserAPI
impl Send for UserAPI
impl Sync for UserAPI
impl Unpin for UserAPI
impl !UnwindSafe for UserAPI
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