allocative/impls/std/
function.rs

1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under both the MIT license found in the
5 * LICENSE-MIT file in the root directory of this source tree and the Apache
6 * License, Version 2.0 found in the LICENSE-APACHE file in the root directory
7 * of this source tree.
8 */
9
10use crate::allocative_trait::Allocative;
11use crate::visitor::Visitor;
12
13impl<R> Allocative for fn() -> R {
14    fn visit<'a, 'b: 'a>(&self, visitor: &'a mut Visitor<'b>) {
15        visitor.visit_simple_sized::<Self>();
16    }
17}
18
19impl<R, A> Allocative for fn(A) -> R {
20    fn visit<'a, 'b: 'a>(&self, visitor: &'a mut Visitor<'b>) {
21        visitor.visit_simple_sized::<Self>();
22    }
23}
24impl<R, A, B> Allocative for fn(A, B) -> R {
25    fn visit<'a, 'b: 'a>(&self, visitor: &'a mut Visitor<'b>) {
26        visitor.visit_simple_sized::<Self>();
27    }
28}
29impl<R, A, B, C> Allocative for fn(A, B, C) -> R {
30    fn visit<'a, 'b: 'a>(&self, visitor: &'a mut Visitor<'b>) {
31        visitor.visit_simple_sized::<Self>();
32    }
33}
34
35impl<R, A, B, C, D> Allocative for fn(A, B, C, D) -> R {
36    fn visit<'a, 'b: 'a>(&self, visitor: &'a mut Visitor<'b>) {
37        visitor.visit_simple_sized::<Self>();
38    }
39}
40
41impl<R, A, B, C, D, E> Allocative for fn(A, B, C, D, E) -> R {
42    fn visit<'a, 'b: 'a>(&self, visitor: &'a mut Visitor<'b>) {
43        visitor.visit_simple_sized::<Self>();
44    }
45}