ToStub

Trait ToStub 

Source
pub trait ToStub {
    // Required method
    fn fmt_stub(&self, buf: &mut String) -> FmtResult;

    // Provided method
    fn to_stub(&self) -> Result<String, FmtError> { ... }
}
Expand description

Implemented on types which can be converted into PHP stubs.

Required Methods§

Source

fn fmt_stub(&self, buf: &mut String) -> FmtResult

Converts the implementor into PHP code, represented as a PHP stub.

§Parameters
  • buf - The buffer to write the PHP code into.
§Returns

Returns nothing on success.

§Errors

Returns an error if there was an error writing into the buffer.

Provided Methods§

Source

fn to_stub(&self) -> Result<String, FmtError>

Converts the implementor into PHP code, represented as a PHP stub. Returned as a string.

§Returns

Returns a string on success.

§Errors

Returns an error if there was an error writing into the string.

Implementors§

Source§

impl ToStub for DataType

Source§

impl ToStub for Visibility

Source§

impl ToStub for Class

Source§

impl ToStub for Constant

Source§

impl ToStub for DocBlock

Source§

impl ToStub for Enum

Available on crate feature enum only.
Source§

impl ToStub for EnumCase

Available on crate feature enum only.
Source§

impl ToStub for Function

Source§

impl ToStub for Method

Source§

impl ToStub for Module

Source§

impl ToStub for Parameter

Source§

impl ToStub for Property