Documentation

Struct Documentation 

Source
#[non_exhaustive]
pub struct Documentation { pub summary: String, pub pages: Vec<Page>, pub rules: Vec<DocumentationRule>, pub documentation_root_url: String, pub service_root_url: String, pub overview: String, /* private fields */ }
Expand description

Documentation provides the information for describing a service.

Example:

Documentation is provided in markdown syntax. In addition to standard markdown features, definition lists, tables and fenced code blocks are supported. Section headers can be provided and are interpreted relative to the section nesting of the context where a documentation fragment is embedded.

Documentation from the IDL is merged with documentation defined via the config at normalization time, where documentation provided by config rules overrides IDL provided.

A number of constructs specific to the API platform are supported in documentation text.

In order to reference a proto element, the following notation can be used:

To override the display text used for the link, this can be used:

Text can be excluded from doc using the following notation:

A few directives are available in documentation. Note that directives must appear on a single line to be properly identified. The include directive includes a markdown file from an external source:

The resource_for directive marks a message to be the resource of a collection in REST view. If it is not specified, tools attempt to infer the resource from the operations in a collection:

The directive suppress_warning does not directly affect documentation and is documented together with service config validation.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§summary: String

A short description of what the service does. The summary must be plain text. It becomes the overview of the service displayed in Google Cloud Console. NOTE: This field is equivalent to the standard field description.

§pages: Vec<Page>

The top level pages for the documentation set.

§rules: Vec<DocumentationRule>

A list of documentation rules that apply to individual API elements.

NOTE: All service configuration rules follow “last one wins” order.

§documentation_root_url: String

The URL to the root of documentation.

§service_root_url: String

Specifies the service root url if the default one (the service name from the yaml file) is not suitable. This can be seen in any fully specified service urls as well as sections that show a base that other urls are relative to.

§overview: String

Declares a single overview page. For example:

This is a shortcut for the following declaration (using pages style):

Note: you cannot specify both overview field and pages field.

Implementations§

Source§

impl Documentation

Source

pub fn new() -> Self

Source

pub fn set_summary<T: Into<String>>(self, v: T) -> Self

Sets the value of summary.

Source

pub fn set_pages<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<Page>,

Sets the value of pages.

Source

pub fn set_rules<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<DocumentationRule>,

Sets the value of rules.

Source

pub fn set_documentation_root_url<T: Into<String>>(self, v: T) -> Self

Sets the value of documentation_root_url.

Source

pub fn set_service_root_url<T: Into<String>>(self, v: T) -> Self

Sets the value of service_root_url.

Source

pub fn set_overview<T: Into<String>>(self, v: T) -> Self

Sets the value of overview.

Trait Implementations§

Source§

impl Clone for Documentation

Source§

fn clone(&self) -> Documentation

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Documentation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Documentation

Source§

fn default() -> Documentation

Returns the “default value” for a type. Read more
Source§

impl Message for Documentation

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for Documentation

Source§

fn eq(&self, other: &Documentation) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Documentation

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,