diff options
| author | Mason Reed <mason@vector35.com> | 2025-05-03 23:15:17 -0400 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2025-05-12 17:45:24 -0400 |
| commit | 6264254065bbae9d89f51cf3330379b7ace09592 (patch) | |
| tree | 9ece1d1739215c2faef2d808ef4fdc019ad527fa /rust/src/file_metadata.rs | |
| parent | c3fdda9727f5507818e3f55576ad32215a22b0f9 (diff) | |
[Rust] Return `String` instead of `BnString` for cases where lossy conversion can be tolerated
Still need to go and audit all usage, but realistically the most important places to give the user control are with symbols, where the data can come from non utf8 sources
This is still incomplete, I just looked for usage of -> BnString so any other variant was omitted.
Diffstat (limited to 'rust/src/file_metadata.rs')
| -rw-r--r-- | rust/src/file_metadata.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/rust/src/file_metadata.rs b/rust/src/file_metadata.rs index f1923b40..c14aaf29 100644 --- a/rust/src/file_metadata.rs +++ b/rust/src/file_metadata.rs @@ -68,10 +68,10 @@ impl FileMetadata { unsafe { BNFileMetadataGetSessionId(self.handle) } } - pub fn filename(&self) -> BnString { + pub fn filename(&self) -> String { unsafe { let raw = BNGetFilename(self.handle); - BnString::from_raw(raw) + BnString::into_string(raw) } } @@ -131,8 +131,8 @@ impl FileMetadata { } } - pub fn begin_undo_actions(&self, anonymous_allowed: bool) -> BnString { - unsafe { BnString::from_raw(BNBeginUndoActions(self.handle, anonymous_allowed)) } + pub fn begin_undo_actions(&self, anonymous_allowed: bool) -> String { + unsafe { BnString::into_string(BNBeginUndoActions(self.handle, anonymous_allowed)) } } pub fn commit_undo_actions<S: BnStrCompatible>(&self, id: S) { @@ -161,8 +161,8 @@ impl FileMetadata { } } - pub fn current_view(&self) -> BnString { - unsafe { BnString::from_raw(BNGetCurrentView(self.handle)) } + pub fn current_view(&self) -> String { + unsafe { BnString::into_string(BNGetCurrentView(self.handle)) } } pub fn current_offset(&self) -> u64 { |
