Cannabis is the only drug (that I am aware of) in the UK that has specific legislation, even though it is class B. Keep in mind that a U-Turn on drug policy is going to happen in the next few years, at least in small steps. The first stage of this is medical mitigation. Briefly, in the recent publication of new judicial guidelines, legitimate medical use of cannabis can be used as a mitigating factor in cannabis related offences, both growing and possession (9 average plants is considered personal assuming no signs of intent to supply such as scales, baggies etc). This is contrary to the Home Office's mandate that cannabis holds no medical value - what bastards
http://www.gwpharm.com/sativex.aspx < cannabis in a bottle, approved by the UK gov and many more, grown and produced in the UK too...
But I digress...
Assuming the officer who stops you has not done so before, you're over 18, you're not doing anything stupid and you are respectful/polite (they are doing their job after all no matter how you feel about it), you are most likely getting a street caution or as they are otherwise known, a cannabis caution. They take your bud and normally "destroy it" in front of you by putting it down a drain or similar, you are given a verbal warning and in rare instances a little slip. They will ask you a few questions but most likely wont write them down, at least the last two I have got for smoking in the street (stupidly) I was basically told not to do it again and lost my half smoked joint.
I believe that they are not shown on your record and it pretty much requires the same officer to pull you again for anything more to happen from it but you should
confirm this with a reliable source.
Worst case scenario, if the office is anti-cannabis then you are probably going to the station for a formal caution, that's a fair bit of paperwork for a gram but "haters gonna hate" and there are still plenty of officers who will do all they can to keep the "evil weed" off the street...
Know your rights -> RELEASE do a great pocket reference about stop and search, ive used them myself for questions about scenarios I have been in, they are fantastic. As mentioned above, don't give the police a reason to stop you in the first place. If you have a legitimate medical need and you are been open with your GP then ensure you have the information required to contest medical mitigation. You wont keep your weed but you will save some possible hassle. Organisations like NORML are also good if you have questions about things like this.