feat: add Buffer.reset_from_string_and_update function

This commit is contained in:
CJ van den Berg 2025-08-05 14:59:07 +02:00
parent 652db7d9b9
commit 3cace58049
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -1184,6 +1184,13 @@ pub fn load_from_string_and_update(self: *Self, file_path: []const u8, s: []cons
self.mtime = std.time.milliTimestamp();
}
pub fn reset_from_string_and_update(self: *Self, s: []const u8) LoadFromStringError!void {
self.root = try self.load_from_string(s, &self.file_eol_mode, &self.file_utf8_sanitized);
self.last_save = self.root;
self.last_save_eol_mode = self.file_eol_mode;
self.mtime = std.time.milliTimestamp();
}
pub const LoadFromFileError = error{
OutOfMemory,
Unexpected,