Skip to main content

Questions tagged [trait]

A scala trait is roughly the equivalent of an interface in Java. It can be extended as if it were a class, and can contain concrete and abstract methods as well as variables.

2 votes
0 answers
87 views

While implementing a proprietary networking protocol, I found myself instantiating buffers of different sizes all the time, reading from a std::io::Reader into it ...
user avatar
4 votes
1 answer
166 views

Problem: In order to be able to use the arrow crate's infer_file_schema function with input piped to ...
Cornelius Roemer's user avatar
0 votes
1 answer
123 views

I want to extend generic iterators with a convenience function until() that works like an inversion of take_while(). Here is the ...
user avatar
2 votes
1 answer
732 views

I am trying to hide the implementation details of accessing a Postgres database. To do this, I want to create "database" and "transaction" traits for use in a repository struct. ...
haz's user avatar
  • 255
1 vote
1 answer
114 views

As a purely pedagogical exercise, I've been trying to use Rust's (very expressive) type system to define the bare minimum one might expect from an ordinary list type. While there's likely a higher-...
jmcph4's user avatar
  • 198
3 votes
1 answer
328 views

I have question about scope yesterday, and someone gives an answer to don't return anything in scope. Is return something in scope really bad practice? Should I not return anything in the model ...
Muhammad Dyas Yaskur's user avatar
1 vote
1 answer
84 views

I have an interface which is for an object which has bounds in a 2D plane. ...
Adam Arold's user avatar
0 votes
1 answer
439 views

I started learning Scala, and like most functional languages, things get messy pretty quickly for a beginner. Here I have built a wrapper class for Ints so that I ...
smac89's user avatar
  • 1,539
0 votes
1 answer
118 views

I have an abstract class Consumer: ...
FakeHeal's user avatar
  • 155
2 votes
0 answers
3k views

Overview:: I have a Restful API that pushes all /api/{version}/{Repository} into my ResourceV{1}Controller depending on the <...
Dustin Parham's user avatar
12 votes
1 answer
2k views

These are some macros to help build a traits class (for the parser/printer classes I am building). Traits.h ...
Loki Astari's user avatar
  • 97.7k
62 votes
3 answers
52k views

I just tried PHP Traits for the first time, to keep my code DRY : ...
Marcel Burkhard's user avatar
2 votes
2 answers
3k views

An implementation of the singleton pattern in PHP using a trait (added in 5.4). Is there anything missing, any ways to create a second copy of the class? ...
Spencer's user avatar
  • 217