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 aString
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
-
target
- Target represents the target interpreter that will be used for the transformation. This can be anything that implements theTargetIntepreter
Trait. By default this can be aString
or&str
N/B: The targets that can be used as of now are, “flow” & “typescript” (more to come…).
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
impl<S> RefUnwindSafe for Source<S> where
S: RefUnwindSafe,
impl<S> UnwindSafe for Source<S> where
S: UnwindSafe,