Struct DocumentationBuilder

Source
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>>§related_udfs: Option<Vec<String>>

Implementations§

Source§

impl DocumentationBuilder

Source

pub fn new() -> DocumentationBuilder

👎Deprecated since 44.0.0: please use DocumentationBuilder::new_with_details instead
Source

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

Source

pub fn with_doc_section(self, doc_section: DocSection) -> DocumentationBuilder

Source

pub fn with_description( self, description: impl Into<String>, ) -> DocumentationBuilder

Source

pub fn with_syntax_example( self, syntax_example: impl Into<String>, ) -> DocumentationBuilder

Source

pub fn with_sql_example( self, sql_example: impl Into<String>, ) -> DocumentationBuilder

Source

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.

Source

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.
Source

pub fn with_alternative_syntax( self, syntax_name: impl Into<String>, ) -> DocumentationBuilder

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,