Struct typify_gostruct::Source[][src]

pub struct Source<S>(_);
Expand description

The source holds the go-lang struct(s) that you want to transform

Implementations

Returns a new Source which can then be transfomed.

Arguments

  • input - Anything that implements the Input trait. (by default this either a String or &str)

Examples

use typify_gostruct;
let input = r#"
type Region struct {
Country string `json:"country" binding:"required"`
State string
}"#;
let source = typify_gostruct::Source::new(input);

Returns the transformed go-lang struct.

Arguments

Examples

use typify_gostruct;
let input = r#"
type Region struct {
Country string `json:"country" binding:"required"`
State string
}"#;
let source = typify_gostruct::Source::new(input);
let result = source.transform_to("flow").expect("The struct should be transformed without an issue");
assert!(result.contains("// @flow"))

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.