-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: I want to wrap `IpAddr` in a following diff, so I'm implementing `Allocative` to make that more natural. Reviewed By: pallotron Differential Revision: D62303400 fbshipit-source-id: da973460b78ca7b980dc60aca5364aa8f09fce19
- Loading branch information
1 parent
a1a432a
commit 790c04f
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ mod cell; | |
mod collections; | ||
mod function; | ||
mod mem; | ||
mod net; | ||
mod primitive; | ||
mod sync; | ||
mod time; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* 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::net::IpAddr; | ||
use std::net::Ipv4Addr; | ||
use std::net::Ipv6Addr; | ||
|
||
use crate::allocative_trait::Allocative; | ||
use crate::visitor::Visitor; | ||
|
||
impl Allocative for IpAddr { | ||
fn visit<'a, 'b: 'a>(&self, visitor: &'a mut Visitor<'b>) { | ||
visitor.enter_self_sized::<Self>().exit(); | ||
} | ||
} | ||
|
||
impl Allocative for Ipv4Addr { | ||
fn visit<'a, 'b: 'a>(&self, visitor: &'a mut Visitor<'b>) { | ||
visitor.enter_self_sized::<Self>().exit(); | ||
} | ||
} | ||
|
||
impl Allocative for Ipv6Addr { | ||
fn visit<'a, 'b: 'a>(&self, visitor: &'a mut Visitor<'b>) { | ||
visitor.enter_self_sized::<Self>().exit(); | ||
} | ||
} |