Re: [PATCH v3 1/2] rust: sizes: add DeviceSize trait for device address space constants
From: John Hubbard
Date: Thu Apr 02 2026 - 21:37:22 EST
On 4/1/26 6:42 PM, Alexandre Courbot wrote:
> On Thu Apr 2, 2026 at 6:20 AM JST, Danilo Krummrich wrote:
>> On Wed Apr 1, 2026 at 10:22 PM CEST, John Hubbard wrote:
>>> On 4/1/26 2:46 AM, Alice Ryhl wrote:
...
>> The reason is that when I proposed this I was thinking of it as a marker trait
>> for "complex" types around u32, u64, etc. that we can use in DRM APIs (or any
>> other device centric API) though generics.
>>
>> For instance, instead of GpuVm<T>::vm_start() -> u64, it could be
>> GpuVm<T, V: DeviceSize>::vm_start() -> V.
>
> With the proposed naming this becomes `GpuVm<T, V: SizeConstants>`. Why
> not just name it `Size`? Sure it's a very common word, but we have the
> module to scope the name properly.
I was waiting to see if anyone else weighed in.
SizeConstants accurately describes what this trait provides. Size is
too general. Again, I think it's best to name things for what they
are or what they provide. And then, if they look odd in some use case,
that's a hint to consider if that use case is precisely the best way
to compose what you want to do.
Anyway, I'm pretty sold on SizeConstants, so I'm hoping to stay with
that, are you OK with it?
thanks,
--
John Hubbard