mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
parent
26d9b2f317
commit
80d5ffbe7c
4 changed files with 6 additions and 23 deletions
|
@ -1,23 +1,8 @@
|
||||||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
use deno_runtime::deno_napi::*;
|
use deno_runtime::deno_napi::*;
|
||||||
use std::cell::Cell;
|
|
||||||
|
|
||||||
unsafe fn get_backing_store_slice(
|
|
||||||
backing_store: &mut v8::SharedRef<v8::BackingStore>,
|
|
||||||
byte_offset: usize,
|
|
||||||
byte_length: usize,
|
|
||||||
) -> &mut [u8] {
|
|
||||||
let cells: *const [Cell<u8>] =
|
|
||||||
&backing_store[byte_offset..byte_offset + byte_length];
|
|
||||||
let mut bytes = cells as *mut [u8];
|
|
||||||
&mut *bytes
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_array_buffer_ptr(ab: v8::Local<v8::ArrayBuffer>) -> *mut u8 {
|
pub fn get_array_buffer_ptr(ab: v8::Local<v8::ArrayBuffer>) -> *mut u8 {
|
||||||
let mut backing_store = ab.get_backing_store();
|
// SAFETY: Thanks to the null pointer optimization, NonNull<T> and Option<NonNull<T>> are guaranteed
|
||||||
let byte_length = ab.byte_length();
|
// to have the same size and alignment.
|
||||||
let mut slice =
|
unsafe { std::mem::transmute(ab.data()) }
|
||||||
unsafe { get_backing_store_slice(&mut backing_store, 0, byte_length) };
|
|
||||||
slice.as_mut_ptr()
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,7 +284,7 @@ fn print_tree_node<TWrite: Write>(
|
||||||
fn print_children<TWrite: Write>(
|
fn print_children<TWrite: Write>(
|
||||||
writer: &mut TWrite,
|
writer: &mut TWrite,
|
||||||
prefix: &str,
|
prefix: &str,
|
||||||
children: &Vec<TreeNode>,
|
children: &[TreeNode],
|
||||||
) -> fmt::Result {
|
) -> fmt::Result {
|
||||||
const SIBLING_CONNECTOR: char = '├';
|
const SIBLING_CONNECTOR: char = '├';
|
||||||
const LAST_SIBLING_CONNECTOR: char = '└';
|
const LAST_SIBLING_CONNECTOR: char = '└';
|
||||||
|
|
|
@ -318,9 +318,7 @@ fn compute_next_deadline(cron_expression: &str) -> Result<u64, AnyError> {
|
||||||
Ok(next_deadline.timestamp_millis() as u64)
|
Ok(next_deadline.timestamp_millis() as u64)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_backoff_schedule(
|
fn validate_backoff_schedule(backoff_schedule: &[u32]) -> Result<(), AnyError> {
|
||||||
backoff_schedule: &Vec<u32>,
|
|
||||||
) -> Result<(), AnyError> {
|
|
||||||
if backoff_schedule.len() > MAX_BACKOFF_COUNT {
|
if backoff_schedule.len() > MAX_BACKOFF_COUNT {
|
||||||
return Err(type_error("Invalid backoff schedule"));
|
return Err(type_error("Invalid backoff schedule"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.75.0"
|
channel = "1.76.0"
|
||||||
components = ["rustfmt", "clippy"]
|
components = ["rustfmt", "clippy"]
|
||||||
|
|
Loading…
Reference in a new issue