glib

Function file_set_contents

Source
pub fn file_set_contents(
    filename: impl AsRef<Path>,
    contents: &[u8],
) -> Result<(), Error>
Expand description

Writes all of @contents to a file named @filename. This is a convenience wrapper around calling g_file_set_contents_full() with flags set to G_FILE_SET_CONTENTS_CONSISTENT | G_FILE_SET_CONTENTS_ONLY_EXISTING and mode set to 0666.

§filename

name of a file to write @contents to, in the GLib file name encoding

§contents

string to write to the file

§Returns

true on success, false if an error occurred Writes all of @contents to a file named @filename. This is a convenience wrapper around calling g_file_set_contents_full() with flags set to G_FILE_SET_CONTENTS_CONSISTENT | G_FILE_SET_CONTENTS_ONLY_EXISTING and mode set to 0666.

§filename

name of a file to write @contents to, in the GLib file name encoding

§contents

string to write to the file

§Returns

true on success, false if an error occurred