gpt4 book ai didi

rust - 一次为多个结构实现一个特征

转载 作者:行者123 更新时间:2023-11-29 08:14:20 24 4
gpt4 key购买 nike

<分区>

我有特征FooTrait,它有很多功能。我也有结构 FooStructBarStruct 并且想为这两个结构实现 FooTrait,方法完全相同。

有没有办法同时为 FooStructBarStruct 实现 FooTrait?我想象如下:

impl FooTrait for FooStruct + BarStruct {
// implement methods here
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com