From 7999bff19fd29893d13f59372fcdf8b14e408727 Mon Sep 17 00:00:00 2001 From: Neil Mitchell Date: Sat, 16 Nov 2024 00:58:45 -0800 Subject: [PATCH] Add an impl for ThreadId Summary: Useful in a project I was working on. Reviewed By: stepancheg Differential Revision: D66030834 fbshipit-source-id: 2b50cb0aa52eeeebf5968b6de5c81680b8f3c1dc --- allocative/allocative/src/impls/std/thread.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 allocative/allocative/src/impls/std/thread.rs diff --git a/allocative/allocative/src/impls/std/thread.rs b/allocative/allocative/src/impls/std/thread.rs new file mode 100644 index 000000000..169348877 --- /dev/null +++ b/allocative/allocative/src/impls/std/thread.rs @@ -0,0 +1,19 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under both the MIT license found in the + * LICENSE-MIT file in the root directory of this source tree and the Apache + * License, Version 2.0 found in the LICENSE-APACHE file in the root directory + * of this source tree. + */ + +use std::thread::ThreadId; + +use crate::allocative_trait::Allocative; +use crate::visitor::Visitor; + +impl Allocative for ThreadId { + fn visit<'a, 'b: 'a>(&self, visitor: &'a mut Visitor<'b>) { + visitor.enter_self_sized::().exit(); + } +}