|
1 | 1 | use command_outcome::Cancelled;
|
2 | 2 | use node_bindgen::{
|
3 |
| - core::{val::JsEnv, NjError, TryIntoJs}, |
| 3 | + core::{safebuffer::SafeArrayBuffer, val::JsEnv, NjError, TryIntoJs}, |
4 | 4 | sys::napi_value,
|
5 | 5 | };
|
6 | 6 | use output::{Empty, StringVec};
|
@@ -138,42 +138,36 @@ impl From<CommandOutcomeWrapper<i64>> for Vec<u8> {
|
138 | 138 |
|
139 | 139 | impl TryIntoJs for CommandOutcomeWrapper<String> {
|
140 | 140 | fn try_to_js(self, js_env: &JsEnv) -> Result<napi_value, NjError> {
|
141 |
| - let bytes: Vec<u8> = self.into(); |
142 |
| - bytes.try_to_js(js_env) |
| 141 | + SafeArrayBuffer::new(self.into()).try_to_js(js_env) |
143 | 142 | }
|
144 | 143 | }
|
145 | 144 |
|
146 | 145 | impl TryIntoJs for CommandOutcomeWrapper<i64> {
|
147 | 146 | fn try_to_js(self, js_env: &JsEnv) -> Result<napi_value, NjError> {
|
148 |
| - let bytes: Vec<u8> = self.into(); |
149 |
| - bytes.try_to_js(js_env) |
| 147 | + SafeArrayBuffer::new(self.into()).try_to_js(js_env) |
150 | 148 | }
|
151 | 149 | }
|
152 | 150 |
|
153 | 151 | impl TryIntoJs for CommandOutcomeWrapper<()> {
|
154 | 152 | fn try_to_js(self, js_env: &JsEnv) -> Result<napi_value, NjError> {
|
155 |
| - let bytes: Vec<u8> = self.into(); |
156 |
| - bytes.try_to_js(js_env) |
| 153 | + SafeArrayBuffer::new(self.into()).try_to_js(js_env) |
157 | 154 | }
|
158 | 155 | }
|
159 | 156 |
|
160 | 157 | impl TryIntoJs for CommandOutcomeWrapper<bool> {
|
161 | 158 | fn try_to_js(self, js_env: &JsEnv) -> Result<napi_value, NjError> {
|
162 |
| - let bytes: Vec<u8> = self.into(); |
163 |
| - bytes.try_to_js(js_env) |
| 159 | + SafeArrayBuffer::new(self.into()).try_to_js(js_env) |
164 | 160 | }
|
165 | 161 | }
|
166 | 162 |
|
167 | 163 | impl TryIntoJs for CommandOutcomeWrapper<Vec<String>> {
|
168 | 164 | fn try_to_js(self, js_env: &JsEnv) -> Result<napi_value, NjError> {
|
169 |
| - let bytes: Vec<u8> = self.into(); |
170 |
| - bytes.try_to_js(js_env) |
| 165 | + SafeArrayBuffer::new(self.into()).try_to_js(js_env) |
171 | 166 | }
|
172 | 167 | }
|
173 | 168 |
|
174 | 169 | impl TryIntoJs for CommandOutcomeWrapper<Option<String>> {
|
175 | 170 | fn try_to_js(self, js_env: &JsEnv) -> Result<napi_value, NjError> {
|
176 |
| - let bytes: Vec<u8> = self.into(); |
177 |
| - bytes.try_to_js(js_env) |
| 171 | + SafeArrayBuffer::new(self.into()).try_to_js(js_env) |
178 | 172 | }
|
179 | 173 | }
|
0 commit comments