pub struct DocumentationBuilder {
pub doc_section: DocSection,
pub description: String,
pub syntax_example: String,
pub sql_example: Option<String>,
pub arguments: Option<Vec<(String, String)>>,
pub alternative_syntax: Option<Vec<String>>,
pub related_udfs: Option<Vec<String>>,
}
Expand description
A builder for Documentation
’s.
Example:
use datafusion_doc::{DocSection, Documentation};
let doc_section = DocSection {
include: true,
label: "Display Label",
description: None,
};
let documentation = Documentation::builder(doc_section, "Add one to an int32".to_owned(), "add_one(2)".to_owned())
.with_argument("arg_1", "The int32 number to add one to")
.build();
Fields§
§doc_section: DocSection
§description: String
§syntax_example: String
§sql_example: Option<String>
§arguments: Option<Vec<(String, String)>>
§alternative_syntax: Option<Vec<String>>
Implementations§
Source§impl DocumentationBuilder
impl DocumentationBuilder
pub fn new() -> DocumentationBuilder
👎Deprecated since 44.0.0: please use
DocumentationBuilder::new_with_details
insteadSourcepub fn new_with_details(
doc_section: DocSection,
description: impl Into<String>,
syntax_example: impl Into<String>,
) -> DocumentationBuilder
pub fn new_with_details( doc_section: DocSection, description: impl Into<String>, syntax_example: impl Into<String>, ) -> DocumentationBuilder
Creates a new DocumentationBuilder
with all required fields
pub fn with_doc_section(self, doc_section: DocSection) -> DocumentationBuilder
pub fn with_description( self, description: impl Into<String>, ) -> DocumentationBuilder
pub fn with_syntax_example( self, syntax_example: impl Into<String>, ) -> DocumentationBuilder
pub fn with_sql_example( self, sql_example: impl Into<String>, ) -> DocumentationBuilder
Sourcepub fn with_argument(
self,
arg_name: impl Into<String>,
arg_description: impl Into<String>,
) -> DocumentationBuilder
pub fn with_argument( self, arg_name: impl Into<String>, arg_description: impl Into<String>, ) -> DocumentationBuilder
Adds documentation for a specific argument to the documentation.
Arguments are displayed in the order they are added.
Sourcepub fn with_standard_argument(
self,
arg_name: impl Into<String>,
expression_type: Option<&str>,
) -> DocumentationBuilder
pub fn with_standard_argument( self, arg_name: impl Into<String>, expression_type: Option<&str>, ) -> DocumentationBuilder
Add a standard “expression” argument to the documentation
The argument is rendered like below if Some() is passed through:
<arg_name>:
<expression_type> expression to operate on. Can be a constant, column, or function, and any combination of operators.
The argument is rendered like below if None is passed through:
<arg_name>:
The expression to operate on. Can be a constant, column, or function, and any combination of operators.
pub fn with_alternative_syntax( self, syntax_name: impl Into<String>, ) -> DocumentationBuilder
Sourcepub fn build(self) -> Documentation
pub fn build(self) -> Documentation
Build the documentation from provided components
Panics if doc_section
, description
or syntax_example
is not set
Auto Trait Implementations§
impl Freeze for DocumentationBuilder
impl RefUnwindSafe for DocumentationBuilder
impl Send for DocumentationBuilder
impl Sync for DocumentationBuilder
impl Unpin for DocumentationBuilder
impl UnwindSafe for DocumentationBuilder
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> 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