(&self, ctx: &Ctx<'js>, encoding: &str)
| 53 | } |
| 54 | |
| 55 | pub fn to_string(&self, ctx: &Ctx<'js>, encoding: &str) -> Result<String> { |
| 56 | Encoder::from_str(encoding) |
| 57 | .and_then(|enc| enc.encode_to_string(self.0.as_ref(), true)) |
| 58 | .or_throw(ctx) |
| 59 | } |
| 60 | |
| 61 | fn from_array_buffer(ctx: &Ctx<'js>, buffer: ArrayBuffer<'js>) -> Result<Value<'js>> { |
| 62 | BufferPrimordials::get(ctx)? |