pub trait GeneratorExt: IsA<Generator> + 'static {
Show 15 methods
// Provided methods
fn indent(&self) -> u32 { ... }
fn indent_char(&self) -> char { ... }
fn is_pretty(&self) -> bool { ... }
fn root(&self) -> Option<Node> { ... }
fn set_indent(&self, indent_level: u32) { ... }
fn set_indent_char(&self, indent_char: char) { ... }
fn set_pretty(&self, is_pretty: bool) { ... }
fn set_root(&self, node: &Node) { ... }
fn to_data(&self) -> (GString, usize) { ... }
fn to_file(&self, filename: impl AsRef<Path>) -> Result<(), Error> { ... }
fn to_stream(
&self,
stream: &impl IsA<OutputStream>,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<(), Error> { ... }
fn connect_indent_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_indent_char_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_pretty_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_root_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}Provided Methods§
Sourcefn indent(&self) -> u32
fn indent(&self) -> u32
Retrieves the value set using set_indent().
§Returns
the number of repetitions per indentation level
Sourcefn indent_char(&self) -> char
fn indent_char(&self) -> char
Sourcefn is_pretty(&self) -> bool
fn is_pretty(&self) -> bool
Retrieves the value set using set_pretty().
§Returns
TRUE if the generated JSON should be pretty-printed, and
FALSE otherwise
Sourcefn set_indent(&self, indent_level: u32)
fn set_indent(&self, indent_level: u32)
Sets the number of repetitions for each indentation level.
§indent_level
the number of repetitions of the indentation character that should be applied when pretty printing
Sourcefn set_indent_char(&self, indent_char: char)
fn set_indent_char(&self, indent_char: char)
Sets the character to be used when indenting.
§indent_char
a Unicode character to be used when indenting
Sourcefn set_pretty(&self, is_pretty: bool)
fn set_pretty(&self, is_pretty: bool)
Sets whether the generated JSON should be pretty printed.
Pretty printing will use indentation character specified in the
indent-char property and the spacing
specified in the indent property.
§is_pretty
whether the generated string should be pretty printed
Sourcefn set_root(&self, node: &Node)
fn set_root(&self, node: &Node)
Sets the root of the JSON data stream to be serialized by the given generator.
The passed node is copied by the generator object, so it can be
safely freed after calling this function.
§node
the root node
Sourcefn to_file(&self, filename: impl AsRef<Path>) -> Result<(), Error>
fn to_file(&self, filename: impl AsRef<Path>) -> Result<(), Error>
Creates a JSON data stream and puts it inside filename, overwriting
the file’s current contents.
This operation is atomic, in the sense that the data is written to a
temporary file which is then renamed to the given filename.
§filename
the path to the target file
§Returns
true if saving was successful.
Sourcefn to_stream(
&self,
stream: &impl IsA<OutputStream>,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<(), Error>
fn to_stream( &self, stream: &impl IsA<OutputStream>, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>
fn connect_indent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_indent_char_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_pretty_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_root_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".