Method
from_data
(meta: &FileMetadata, data: &[u8])
Source from the content-addressed store, hash-verified
| 1906 | } |
| 1907 | |
| 1908 | pub fn from_data(meta: &FileMetadata, data: &[u8]) -> Result<Ref<Self>> { |
| 1909 | let handle = unsafe { |
| 1910 | BNCreateBinaryDataViewFromData(meta.handle, data.as_ptr() as *mut _, data.len()) |
| 1911 | }; |
| 1912 | |
| 1913 | if handle.is_null() { |
| 1914 | return Err(()); |
| 1915 | } |
| 1916 | |
| 1917 | unsafe { Ok(Ref::new(Self { handle })) } |
| 1918 | } |
| 1919 | |
| 1920 | /// Save the original binary file to the provided `file_path` along with any modifications. |
| 1921 | /// |
Callers
nothing calls this directly
Tested by
no test coverage detected