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§